CREATE TABLE equipment (
    id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
    code TEXT NOT NULL,
    name TEXT NOT NULL,
    kind TEXT,
    description TEXT,
    created_at TIMESTAMPTZ DEFAULT NOW(),
    updated_at TIMESTAMPTZ DEFAULT NOW(),
    UNIQUE (code)
);

ALTER TABLE point
    ADD COLUMN equipment_id UUID REFERENCES equipment(id) ON DELETE SET NULL,
    ADD COLUMN signal_role TEXT;

CREATE INDEX idx_point_equipment_id ON point(equipment_id);
