diff --git a/db/up/jam_track_onboarding_enhancements.sql b/db/up/jam_track_onboarding_enhancements.sql index 1336ecdf4..2a373eb5c 100644 --- a/db/up/jam_track_onboarding_enhancements.sql +++ b/db/up/jam_track_onboarding_enhancements.sql @@ -1,4 +1,17 @@ +-- "rsvp_slots_instrument_id_fkey" FOREIGN KEY (instrument_id) REFERENCES instruments(id) +-- "musicians_instruments_instrument_id_fkey" FOREIGN KEY (instrument_id) REFERENCES instruments(id) ON DELETE CASCADE +-- "saved_tracks_instrument_id_fkey" FOREIGN KEY (instrument_id) REFERENCES instruments(id) ON DELETE CASCADE +ALTER TABLE rsvp_slots DROP CONSTRAINT rsvp_slots_instrument_id_fkey; +ALTER TABLE musicians_instruments DROP CONSTRAINT musicians_instruments_instrument_id_fkey; +ALTER TABLE recorded_tracks DROP CONSTRAINT saved_tracks_instrument_id_fkey; UPDATE instruments SET id = 'double bass', description = 'Double Bass' WHERE id = 'upright bass'; +UPDATE rsvp_slots SET instrument_id = 'double bass' where instrument_id = 'upright bass'; +UPDATE musicians_instruments SET instrument_id = 'double bass' where instrument_id = 'upright bass'; +UPDATE recorded_tracks SET instrument_id = 'double bass' where instrument_id = 'upright bass'; +ALTER TABLE rsvp_slots ADD CONSTRAINT rsvp_slots_instrument_id_fkey FOREIGN KEY (instrument_id) REFERENCES instruments(id) ON DELETE SET NULL; +ALTER TABLE musicians_instruments ADD CONSTRAINT musicians_instruments_instrument_id_fkey FOREIGN KEY (instrument_id) REFERENCES instruments(id) ON DELETE CASCADE; +ALTER TABLE recorded_tracks ADD CONSTRAINT saved_tracks_instrument_id_fkey FOREIGN KEY (instrument_id) REFERENCES instruments(id) ON DELETE CASCADE; + INSERT INTO instruments (id, description, popularity) VALUES ('steel guitar', 'Steel Guitar', 1); INSERT INTO instruments (id, description, popularity) VALUES ('orchestra', 'Orchestra', 1); INSERT INTO instruments (id, description, popularity) VALUES ('glockenspiel', 'Glockenspiel', 1);