-- Additive upgrade after 044, in FinOps (not DET).
-- Suspend discovery, coverage refresh and reconciliation during this migration.
-- Existing aggregates stay version 1 until rebuilt by the new coverage batch.
ALTER TABLE finops_tag_coverage_day
    ADD COLUMN IF NOT EXISTS format_version SMALLINT UNSIGNED NOT NULL DEFAULT 1;
ALTER TABLE finops_tag_coverage_set
    ADD COLUMN IF NOT EXISTS has_tags TINYINT(1) NOT NULL DEFAULT 0,
    ADD COLUMN IF NOT EXISTS present_keys LONGTEXT NOT NULL DEFAULT '[]',
    ADD COLUMN IF NOT EXISTS present_key_count INT UNSIGNED NOT NULL DEFAULT 0;
ALTER TABLE finops_tag_coverage_key
    ADD COLUMN IF NOT EXISTS present_lines BIGINT UNSIGNED NOT NULL DEFAULT 0;
