morffix/migrations/000024_migrate_logs.up.sql
Samuel Lorch f52f517dc1
All checks were successful
/ release (push) Successful in 1m23s
Move logs from array to dedicated table
This avoids the append problem which bloats the database to 200+ gb in a
month and shrinks again to 5g with a full vacuum
2025-05-18 19:18:52 +02:00

3 lines
119 B
SQL

INSERT INTO logs (task_id, message)
SELECT id as task_id, l as message
FROM tasks, unnest(log) l ORDER BY task_id ASC;