database: attribute and view changes
This commit is contained in:
@ -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;
|
||||
|
@ -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
|
||||
|
Reference in New Issue
Block a user