Drop enrichment_attempts default after backfill

Columns must not carry DEFAULT clauses. The DEFAULT only backfills
existing rows when the non-nullable column is added, so drop it in the
same migration; inserts already supply enrichment_attempts explicitly.

Signed-off-by: Émile Ré <emile@probo.com>
This commit is contained in:
Émile Ré
2026-06-11 18:31:24 +02:00
parent b617741feb
commit 08ff9277e7

View File

@@ -21,6 +21,13 @@ ADD
ADD
COLUMN enrichment_attempts INTEGER NOT NULL DEFAULT 0;
-- The DEFAULT only backfills existing rows; drop it so inserts must
-- supply the value explicitly.
ALTER TABLE
common_third_parties
ALTER COLUMN
enrichment_attempts DROP DEFAULT;
-- Partial index backs the enrichment worker's claim query, which polls
-- only rows currently queued for enrichment.
CREATE INDEX common_third_parties_enrichment_requested_at_idx