AppDbUpdater: Extract sql commands as embedded resources

This commit is contained in:
2024-01-05 13:17:29 +01:00
parent ab61edc402
commit f28a1a2db9
13 changed files with 695 additions and 756 deletions

View File

@ -0,0 +1,19 @@
-- schema version 9 to 10
UPDATE wine_quality_level SET min_kmw = 10.6 WHERE qualid = 'RSW';
DROP VIEW v_area_commitment_bucket;
CREATE VIEW v_area_commitment_bucket AS
SELECT year, mgnr, bucket, area, min_kg, max_kg
FROM v_area_commitment_bucket_strict
WHERE attrid IS NOT NULL
UNION ALL
SELECT b.year, b.mgnr, b.sortid,
SUM(b.area) AS area,
SUM(b.min_kg) AS min_kg,
SUM(b.upper_max_kg) AS max_kg
FROM v_area_commitment_bucket_strict b
LEFT JOIN wine_attribute a ON a.attrid = b.attrid
WHERE a.strict IS NULL OR a.strict = FALSE
GROUP BY b.year, b.mgnr, b.sortid
ORDER BY year, mgnr, bucket;