database: attribute and view changes

This commit is contained in:
2023-10-14 23:58:25 +02:00
parent 593eae7da4
commit 65ad166d87
2 changed files with 6 additions and 5 deletions

View File

@ -255,11 +255,12 @@ CREATE TABLE branch (
) STRICT;
CREATE TABLE wine_attribute (
attrid TEXT NOT NULL CHECK (attrid REGEXP '^[A-Z]+$'),
name TEXT NOT NULL,
attrid TEXT NOT NULL CHECK (attrid REGEXP '^[A-Z]+$'),
name TEXT NOT NULL,
max_kg_per_ha INTEGER,
active INTEGER NOT NULL CHECK (active IN (TRUE, FALSE)) DEFAULT TRUE,
max_kg_per_ha INTEGER,
fill_lower_bins INTEGER NOT NULL CHECK (fill_lower_bins IN (TRUE, FALSE)) DEFAULT FALSE,
active INTEGER NOT NULL CHECK (active IN (TRUE, FALSE)) DEFAULT TRUE,
CONSTRAINT pk_wine_attribute PRIMARY KEY (attrid)
) STRICT;

View File

@ -35,7 +35,7 @@ FROM delivery_part p
GROUP BY p.year, p.did, p.dpnr
ORDER BY p.year, p.did, p.dpnr;
CREATE VIEW v_bin AS
CREATE VIEW v_delivery_bin AS
SELECT year, mgnr,
sortid || IIF(min_quw, REPLACE(COALESCE(attributes, ''), ',', ''), '_') AS bin,
SUM(weight) AS weight