database: remove delivery_part_attribute table
This commit is contained in:
@ -36,10 +36,9 @@ CREATE TABLE wine_attribute (
|
||||
) STRICT;
|
||||
|
||||
CREATE TABLE area_commitment_type (
|
||||
vtrgid TEXT NOT NULL CHECK (vtrgid LIKE sortid || attrid_1 || attrid_2 || disc),
|
||||
vtrgid TEXT NOT NULL CHECK (vtrgid = sortid || COALESCE(attrid, '') || disc),
|
||||
sortid TEXT NOT NULL,
|
||||
attrid_1 TEXT,
|
||||
attrid_2 TEXT,
|
||||
attrid TEXT,
|
||||
disc TEXT DEFAULT NULL CHECK (disc REGEXP '^[A-Z0-9]+$'),
|
||||
|
||||
min_kg_per_ha INTEGER,
|
||||
@ -47,14 +46,11 @@ CREATE TABLE area_commitment_type (
|
||||
penalty_amount INTEGER,
|
||||
|
||||
CONSTRAINT pk_area_commitment_type PRIMARY KEY (vtrgid),
|
||||
CONSTRAINT sk_area_commitment_type_sort_attr UNIQUE (sortid, attrid_1, attrid_2, disc),
|
||||
CONSTRAINT sk_area_commitment_type_sort_attr UNIQUE (sortid, attrid, disc),
|
||||
CONSTRAINT fk_area_commitment_type_wine_variety FOREIGN KEY (sortid) REFERENCES wine_variety (sortid)
|
||||
ON UPDATE CASCADE
|
||||
ON DELETE RESTRICT,
|
||||
CONSTRAINT fk_area_commitment_type_wine_attribute FOREIGN KEY (attrid_1) REFERENCES wine_attribute (attrid)
|
||||
ON UPDATE CASCADE
|
||||
ON DELETE RESTRICT,
|
||||
CONSTRAINT fk_area_commitment_type_wine_attribute FOREIGN KEY (attrid_2) REFERENCES wine_attribute (attrid)
|
||||
CONSTRAINT fk_area_commitment_type_wine_attribute FOREIGN KEY (attrid) REFERENCES wine_attribute (attrid)
|
||||
ON UPDATE CASCADE
|
||||
ON DELETE RESTRICT
|
||||
) STRICT;
|
||||
|
Reference in New Issue
Block a user