Skip to content

Instantly share code, notes, and snippets.

@flangofas
Last active March 19, 2020 13:49
Show Gist options
  • Save flangofas/95099b60e87a18b0e7f84d2d0f54f0c1 to your computer and use it in GitHub Desktop.
Save flangofas/95099b60e87a18b0e7f84d2d0f54f0c1 to your computer and use it in GitHub Desktop.
Store procedures for deleting dummies users
# 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