Skip to content
This repository has been archived by the owner on Nov 23, 2018. It is now read-only.

Add a way to delete accounts #45

Open
whymarrh opened this issue Jul 11, 2013 · 6 comments
Open

Add a way to delete accounts #45

whymarrh opened this issue Jul 11, 2013 · 6 comments

Comments

@whymarrh
Copy link
Contributor

Currently there is no way to delete an account after its creation.

@whymarrh
Copy link
Contributor Author

How is this best implemented? /cc @binny45

@MitMaro
Copy link
Member

MitMaro commented Jul 31, 2013

Perhaps just disable account. Facebook didn't have delete for a long time.

Though this would be trivial for us to do since our database is fairly simple.

@whymarrh
Copy link
Contributor Author

whymarrh commented Aug 8, 2013

Like you said, the database is rather simple. It may be easiest to delete them from the database -- could each user have a simple settings page showing them the option?

@MitMaro
Copy link
Member

MitMaro commented Aug 17, 2014

Just some more information on what would need to be performed to delete a user (this should be done in a transaction):

DELETE FROM `user_display_name` WHERE `user_id` = $id
DELETE FROM `account` WHERE `user_id` = $id
DELETE FROM `user_contact` WHERE `user_a_id` = $id or `user_b_id` = $id
DELETE FROM `user` WHERE `user_a_id` = $id
$s_ids = SELECT `schedule_id` FROM `user_schedule` WHERE `user_id` = $id
foreach ($s_id in $s_ids):
    DELETE FROM `schedule_interval` WHERE `schedule_id` = $s_id
    DELETE FROM `schedule` WHERE `id` = $s_id
    DELETE FROM `score` WHERE `schedule_id` = $s_id
DELETE FROM `user_schedule` WHERE `user_id` = $id
DELETE FROM `score` WHERE `user_a_id` = $id OR `user_b_id` = $id -- Redundant really, they should already be done since the schedule was delete for the users above

@whymarrh
Copy link
Contributor Author

In the schema we defined, would the cascades not make a few of those lines invalid/unnecessary?

@MitMaro
Copy link
Member

MitMaro commented Aug 17, 2014

Depends on the database system. If cascades are enabled then yes they would be unnecessary. It wasn't meant to be SQL to run, more of an easy way to define what would need to be deleted.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants