Last active
March 19, 2020 13:49
-
-
Save flangofas/95099b60e87a18b0e7f84d2d0f54f0c1 to your computer and use it in GitHub Desktop.
Store procedures for deleting dummies users
This file contains 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
# Change delimiter // so SP can be created | |
DELIMITER // | |
CREATE PROCEDURE selectXamplifierUsers() | |
BEGIN | |
select id from users where is_system_user = 0 and email like "%xamplifier%"; | |
END | |
// | |
CREATE PROCEDURE deleteXamplifierUsers() | |
BEGIN | |
delete from referral_program_user_surveys where user_id in (select id from users where is_system_user = 0 and email like "%xamplifier%"); | |
delete from referral_program_users where user_id in (select id from users where is_system_user = 0 and email like "%xamplifier%"); | |
delete from referral_links where user_id in (select id from users where is_system_user = 0 and email like "%xamplifier%"); | |
delete from user_rewards where user_id in (select id from users where is_system_user = 0 and email like "%xamplifier%"); | |
delete from users where is_system_user = 0 and email like "%xamplifier%"; | |
END | |
// | |
# Change delimiter back to normal | |
DELIMETER; | |
# Run by using: call selectXamplifierUsers, call deleteXamplifierUsers |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment