-- Migration 121: Gear documents (v0.802 GR1)
CREATE TABLE IF NOT EXISTS gear_documents (
    id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
    gear_id UUID NOT NULL REFERENCES gear_items(id) ON DELETE CASCADE,
    type VARCHAR(50) NOT NULL DEFAULT 'invoice',
    storage_key TEXT NOT NULL,
    filename VARCHAR(255) NOT NULL,
    uploaded_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
);

CREATE INDEX idx_gear_documents_gear_id ON gear_documents(gear_id);
