Problem Statement
It is not currently possible to document the fill status of bottles.
Proposed Solution / Workflow
- Create new table
bottle_shapes:
CREATE TABLE bottle_shapes (
id INT PRIMARY KEY AUTO_INCREMENT,
shape_name VARCHAR(50) NOT NULL UNIQUE -- e.g., 'Bordeaux', 'Burgundy', 'Alsace'
);
- Create new table
ullage:
CREATE TABLE ullage (
code VARCHAR(10) PRIMARY KEY, -- 'IN', 'BN', 'TS', 'HS', 'MS', 'LS'
description VARCHAR(100) NOT NULL -- 'Into neck', 'Base of neck', etc.
);
- Alter
bottles table:
-- 3.1. Add new columns
ALTER TABLE bottles
ADD COLUMN bottle_shape_id INT NOT NULL,
ADD COLUMN ullage VARCHAR(10) NULL,
ADD COLUMN fill_level_cm DECIMAL(4,2) NULL;
-- 3.2. Add FK constraints
ALTER TABLE bottles
ADD CONSTRAINT fk_bottle_shape FOREIGN KEY (bottle_shape_id) REFERENCES bottle_shapes(id),
ADD CONSTRAINT fk_fill_category FOREIGN KEY (ullage) REFERENCES ullage(code);
-- 3.3. Add check constraint to ensure only one is used
ALTER TABLE bottles
ADD CONSTRAINT chk_fill_level_logic
CHECK (
(ullage IS NOT NULL AND fill_level_cm IS NULL)
OR
(ullage IS NULL AND fill_level_cm IS NOT NULL)
);
- Handle the shape-to-measurement mapping in the application layer.
- Add new columns to all backend and frontend pages.
Alternatives Considered
No response
Additional Context
No response
Checklist
Problem Statement
It is not currently possible to document the fill status of bottles.
Proposed Solution / Workflow
bottle_shapes:ullage:bottlestable:Alternatives Considered
No response
Additional Context
No response
Checklist