-- Link spreader settings to actual user equipment instead of storing text
-- This allows better integration and recommendations

-- Add equipment reference to product_spreader_settings
ALTER TABLE product_spreader_settings 
ADD COLUMN IF NOT EXISTS equipment_id INTEGER REFERENCES user_equipment(id) ON DELETE CASCADE;

-- Create index for the new relationship
CREATE INDEX IF NOT EXISTS idx_product_spreader_settings_equipment ON product_spreader_settings(equipment_id);

-- We'll keep the old columns for backward compatibility during transition
-- They can be removed later once all data is migrated

SELECT 'Added equipment reference to spreader settings!' as migration_status;