Last active
April 13, 2020 21:50
-
-
Save afquinterog/3c33ca1dd258c42cc441f4ffd2f13a89 to your computer and use it in GitHub Desktop.
delete syndication 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
DO $$ | |
declare | |
userToDelete UUID; | |
BEGIN | |
SET SCHEMA 'independentco'; | |
select INTO userToDelete user_id | |
from users_roles where role_id IN ( | |
select id | |
from roles | |
where name = 'syndication_service' | |
); | |
raise notice 'Syndication user = %', userToDelete; | |
delete from oauth_tokens where oauth_client_id IN | |
(select id from oauth_clients where user_id=userToDelete); | |
delete from oauth_client_users where oauth_client_id IN | |
(select id from oauth_clients where user_id=userToDelete); | |
delete from oauth_clients where user_id = userToDelete; | |
delete from accreditations where user_id=userToDelete; | |
delete from users_roles where user_id=userToDelete; | |
delete from street_addresses where user_id=userToDelete; | |
delete from assets where user_id = userToDelete; | |
delete from users where id = userToDelete ; | |
END$$; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment