-
Notifications
You must be signed in to change notification settings - Fork 308
Normalize accounts that were closed manually #2507
Conversation
, giving = 0 | ||
, pledging = 0 | ||
, receiving = 0 | ||
WHERE username LIKE 'deactivated-%'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a need to set so many things? It seems like all you'd want is:
UPDATE participants
SET username = substring(username from 13)
, username_lower = lower(substring(username from 13))
, is_closed = true
WHERE username LIKE 'deactivated-%';
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@seanlinsley Yes, we want to clear personal information, like the new account closing process does.
I'm comparing this SQL to what we have under Participant.close. Is there a reason we're not worrying about community or team memberships here? In general, I'm finding it tedious to compare the behavior of this SQL with the behavior of Participant.close. Would it make more sense to do something like (untested) ... #!/usr/bin/env python
from gittip import wireup
db = wireup.db(wireup.env())
deactivated = db.all("select participants.*::participants from participants "
"where username like 'deactivated-%'")
for participant in deactivated:
participant.change_username(participant.username[len('deactivated-'):])
participant.close(disbursement_strategy=None) |
Community memberships because I forgot, team memberships because there aren't any.
Maybe, but we'll have to deal with the problem that one of the participants has a nonzero balance, otherwise we'll get |
That sounds like something we'll have to deal with anyway. Do they have any tips set up? |
@Changaco I've dealt with the balance by refunding it to the person it came from originally, which is what the person closing their account wanted. Note though that it had been given to an account that was merged with another, which I believe is how we ended up in this situation in the first place: a deactivated account with a non-zero balance. |
Can I bump this back to you, @Changaco? |
@whit537 I've rewritten in python and tested on a local backup. Ready for merge. |
Done. !m @Changaco |
#2412 implemented account closing differently than the
deactivate
script that was being run manually before: we don't rename the participant by prefixingdeactivated-
anymore, and we clear personal information. This PR updates the DB to make it as if the deactivated accounts had been closed using the new method.