-- Link a wall outlet to the actual switch hardware, rather than only its display name.
ALTER TABLE locations_wall_outlets
    ADD COLUMN IF NOT EXISTS switch_hardware_id INTEGER
    REFERENCES hardware_assets(id) ON DELETE SET NULL;

CREATE INDEX IF NOT EXISTS idx_wall_outlets_switch_hardware_port
    ON locations_wall_outlets(switch_hardware_id, switch_port)
    WHERE deleted_at IS NULL;
