SCHEMA_V2

Constant SCHEMA_V2 

Source
pub const SCHEMA_V2: &str = "
    CREATE TABLE IF NOT EXISTS export_runs (
        kind             TEXT NOT NULL,
        window_start_ms  INTEGER NOT NULL,
        window_end_ms    INTEGER NOT NULL,
        status           TEXT NOT NULL,
        partial          INTEGER NOT NULL,
        formats          TEXT NOT NULL,
        directory        TEXT NOT NULL,
        consumers        INTEGER NOT NULL,
        requests         INTEGER NOT NULL,
        windows_nonempty INTEGER NOT NULL,
        error            TEXT NOT NULL DEFAULT '',
        generated_at_ms  INTEGER NOT NULL,
        PRIMARY KEY (kind, window_start_ms)
    ) WITHOUT ROWID;
";
Expand description

Schema v2 (DW-120): the export_runs ledger. One row per scheduled-or-manual usage-statement export attempt per window (primary key; a re-export REPLACES the row — the file output is equally idempotent). status is ok or failed; partial flags a window older than the query granularity’s retention (undercounts are possible) so billing consumers can reject flagged statements instead of trusting them; windows_nonempty counts the range’s rollup windows that carry any data (informational — quiet windows have no rows and are not loss).