-- Migration 122: Gear repairs (v0.802 GR1)
CREATE TABLE IF NOT EXISTS gear_repairs (
    id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
    gear_id UUID NOT NULL REFERENCES gear_items(id) ON DELETE CASCADE,
    repair_date DATE NOT NULL,
    description TEXT NOT NULL DEFAULT '',
    cost_cents INTEGER NOT NULL DEFAULT 0,
    currency VARCHAR(3) NOT NULL DEFAULT 'EUR',
    provider VARCHAR(255) DEFAULT '',
    notes TEXT DEFAULT '',
    created_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
);

CREATE INDEX idx_gear_repairs_gear_id ON gear_repairs(gear_id);
