-- schema version 16 to 17

CREATE VIEW v_virtual_season AS
SELECT year, max_kg_per_ha
FROM season
UNION
SELECT strftime('%Y', date()) + 0, (SELECT max_kg_per_ha FROM season ORDER BY year DESC LIMIT 1);

PRAGMA writable_schema = ON;
UPDATE sqlite_schema SET sql = REPLACE(sql, 'season s', 'v_virtual_season s')
WHERE type = 'view' AND name = 'v_area_commitment_bucket_strict';
PRAGMA writable_schema = OFF;
