Skip to content

[Feature]: Add 'fill' to bottles #59

Description

@dmueller-dev

Problem Statement

It is not currently possible to document the fill status of bottles.

Proposed Solution / Workflow

  1. 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'
);
  1. 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.
);
  1. 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)
);
  1. Handle the shape-to-measurement mapping in the application layer.
  2. Add new columns to all backend and frontend pages.

Alternatives Considered

No response

Additional Context

No response

Checklist

  • I have searched existing issues to verify this feature has not already been requested.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions