CREATE TABLE shopping_item_history (
    id SERIAL PRIMARY KEY,
    item_id INTEGER NOT NULL REFERENCES shopping_items(id) ON DELETE CASCADE,
    user_id INTEGER NOT NULL REFERENCES users(id),
    name VARCHAR(255) NOT NULL,
    volume NUMERIC(10,4) NOT NULL DEFAULT 1,
    completed_at TIMESTAMP NOT NULL DEFAULT NOW()
);

CREATE INDEX idx_shopping_item_history_item_id ON shopping_item_history(item_id);
