Created
January 9, 2020 18:18
-
-
Save masterfermin02/f87821d4c50c5183df9826690a91477a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- PE-13003 Seed data - PATCH | |
START TRANSACTION; | |
# Create some riders (9 riders) | |
INSERT INTO riders (id, active, first_name, last_name, email, password, salt, activation_token, region, phone_number, joined, registered_via_oauth_client_id, shipping_first_name, shipping_last_name, address_1, address_2, city, state, country, zip, shoe_size, bike_bar_height, bike_seat_height, bike_seat_distance, bike_handlebar_depth, bike_extended_handlebars, is_staff, emergency_contact_name, emergency_contact_phone, first_ride, series_vertical_redemption_enabled, notes, sent_first_bike_welcome_email, sent_post_first_ride_email, spotify_custom_playlist_uri, spotify_custom_playlist_link, new_rider_agreement_signed, state_text, gender, birthday, updated_at) | |
VALUES ('78791', '1', 'Eddy', 'Espinal', '[email protected]', 'aa259b0bdd3bc4e9d39bfa0dd7645ff103e68021', '5d640f914eb73', '5d640f914ed62', '1', '+12123829933', '2019-08-26 16:57:53', '1', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '0', '0', NULL, NULL, NULL, '0', NULL, '0', '0', NULL, NULL, '0', NULL, NULL, NULL, '2019-08-26 16:57:53'); | |
# get student tag | |
SET @student = (SELECT id FROM tags WHERE name = 'Student'); | |
#Create some rider_tags | |
INSERT INTO rider_tags (rider_id, tag_id, created_at) VALUES (78791, @student, '2019-06-19'); | |
COMMIT; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- PE-13003 Seed data - REVERT | |
START TRANSACTION; | |
SET FOREIGN_KEY_CHECKS = 0; | |
# get student tag | |
SET @student = (SELECT id FROM tags WHERE name = 'Student'); | |
# Delete | |
DELETE riders, | |
rider_tags | |
FROM riders | |
LEFT JOIN rider_tags on riders.id = rider_tags.rider_id AND rider_tags.tag_id = @student | |
WHERE id = 78791; | |
SET FOREIGN_KEY_CHECKS = 1; | |
COMMIT; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment