-- Per-interval candle ingestion progress tracking.
-- Independent cursor per (instrument_id, interval) so 1m can be current
-- while 1d is still backfilling.
CREATE TABLE candle_ingest_cursors (
    instrument_id      INTEGER NOT NULL REFERENCES instruments(id),
    interval           TEXT    NOT NULL,
    last_ingested_date DATE,
    PRIMARY KEY (instrument_id, interval)
);

-- Which candle intervals to sync alongside trades for each ingest_config.
ALTER TABLE ingest_configs ADD COLUMN candle_intervals TEXT[] NOT NULL DEFAULT '{}';
