-- M4 ingestion management: persistent per-source incremental watermark.
-- The updater reads/writes one row per source to resume incremental imports
-- (e.g. Open Food Facts `last_modified_t`) and to record run statistics.
CREATE TABLE ingest_state (
    source          TEXT PRIMARY KEY,
    last_modified_t BIGINT NOT NULL DEFAULT 0,
    last_run_at     TIMESTAMPTZ,
    cursor          TEXT,
    stats           JSONB NOT NULL DEFAULT '{}'
);
