-- Customer feedback system for product improvement
CREATE TABLE product_feedback (
    id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
    transaction_id VARCHAR(255) NOT NULL REFERENCES orders(transaction_id),
    product_id UUID NOT NULL,
    rating INTEGER CHECK (rating >= 1 AND rating <= 5),
    comment TEXT,
    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);

CREATE INDEX idx_feedback_product ON product_feedback(product_id);
CREATE INDEX idx_feedback_transaction ON product_feedback(transaction_id);
