Re: Delete users from sql, auth_user

2012-12-18 Thread Eric Johnson

Hi Ben,

I've resorted to a similar approach to automatically updating the 
database with users.


However, unlike you,it appears, I take a more conservative approach, and 
never *delete* users. Rather, I mark them as inactive. That way, you 
don't have to worry about foreign key constraints.


Eric

On 12/18/12 3:07 AM, Ben Copeland wrote:

Hello,

I import users from active directory using ldap. I do this because 
users are not populated in reviewboard from AD. We add and remove many 
users from our system, so it is easier if this process was linked via 
a sync method. So if users are deleted, added or have a name change 
reviewboard can replicate this.


Currently users are added into reviewboard but we manually delete 
them. I am able to SET FOREIGN_KEY_CHECKS=0 and then delete, then set 
it back to 1, however this is a shortcut?


I'm not familiar with django management commands. Can you control 
users through it?


Regards

On Thursday, 25 October 2012 21:28:40 UTC+1, David Trowbridge wrote:

Can you clarify why you want to do this? As you've noted, review
board
really isn't designed to have users be deleted entirely.

As an aside, it's going to be much, much easier to write these sorts
of scripts as django management commands than to try to do it
operating directly on the database.

-David


On Thu, Oct 25, 2012 at 2:41 AM, Ben Copeland ben.co...@gmail.com
javascript: wrote:
 Hello all,

 I am writing a custom script so users can be added and deleted from
 reviewboard. However how can I delete a user from auth_user,
because I got
 problems with the foreign key constraint.

 I am writing the script in php/mysql.

 Cannot delete or update a parent row: a foreign key constraint
fails
 (`reviewboard`.`accounts_profile`, CONSTRAINT
`user_id_refs_id_46e869e2`
 FOREIGN KEY (`user_id`) REFERENCES `auth_user` (`id`))

 What sql code would I need to delete, or make sure the user and
history are
 deleted properly?

 --
 Want to help the Review Board project? Donate today at
 http://www.reviewboard.org/donate/
http://www.reviewboard.org/donate/
 Happy user? Let us know at http://www.reviewboard.org/users/
http://www.reviewboard.org/users/
 -~--~~~~--~~--~--~---
 To unsubscribe from this group, send email to
 reviewboard...@googlegroups.com javascript:
 For more options, visit this group at
 http://groups.google.com/group/reviewboard?hl=en
http://groups.google.com/group/reviewboard?hl=en



--
Want to help the Review Board project? Donate today at 
http://www.reviewboard.org/donate/

Happy user? Let us know at http://www.reviewboard.org/users/
-~--~~~~--~~--~--~---
To unsubscribe from this group, send email to 
reviewboard+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/reviewboard?hl=en





--
Want to help the Review Board project? Donate today at 
http://www.reviewboard.org/donate/
Happy user? Let us know at http://www.reviewboard.org/users/
-~--~~~~--~~--~--~---
To unsubscribe from this group, send email to 
reviewboard+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/reviewboard?hl=en




Re: Delete users from sql, auth_user

2012-10-25 Thread David Trowbridge
Can you clarify why you want to do this? As you've noted, review board
really isn't designed to have users be deleted entirely.

As an aside, it's going to be much, much easier to write these sorts
of scripts as django management commands than to try to do it
operating directly on the database.

-David


On Thu, Oct 25, 2012 at 2:41 AM, Ben Copeland ben.comob...@gmail.com wrote:
 Hello all,

 I am writing a custom script so users can be added and deleted from
 reviewboard. However how can I delete a user from auth_user, because I got
 problems with the foreign key constraint.

 I am writing the script in php/mysql.

 Cannot delete or update a parent row: a foreign key constraint fails
 (`reviewboard`.`accounts_profile`, CONSTRAINT `user_id_refs_id_46e869e2`
 FOREIGN KEY (`user_id`) REFERENCES `auth_user` (`id`))

 What sql code would I need to delete, or make sure the user and history are
 deleted properly?

 --
 Want to help the Review Board project? Donate today at
 http://www.reviewboard.org/donate/
 Happy user? Let us know at http://www.reviewboard.org/users/
 -~--~~~~--~~--~--~---
 To unsubscribe from this group, send email to
 reviewboard+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/reviewboard?hl=en



-- 
Want to help the Review Board project? Donate today at 
http://www.reviewboard.org/donate/
Happy user? Let us know at http://www.reviewboard.org/users/
-~--~~~~--~~--~--~---
To unsubscribe from this group, send email to 
reviewboard+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/reviewboard?hl=en




Re: Delete users from sql, auth_user

2012-10-25 Thread Eric Johnson
I'd add that it is unlikely that you really want to delete all traces of a user 
in ReviewBoard history. If you need to deactivate an account, why not just do 
that?

Eric

Sent from my iPad

On Oct 25, 2012, at 1:28 PM, David Trowbridge trowb...@gmail.com wrote:

 Can you clarify why you want to do this? As you've noted, review board
 really isn't designed to have users be deleted entirely.
 
 As an aside, it's going to be much, much easier to write these sorts
 of scripts as django management commands than to try to do it
 operating directly on the database.
 
 -David
 
 
 On Thu, Oct 25, 2012 at 2:41 AM, Ben Copeland ben.comob...@gmail.com wrote:
 Hello all,
 
 I am writing a custom script so users can be added and deleted from
 reviewboard. However how can I delete a user from auth_user, because I got
 problems with the foreign key constraint.
 
 I am writing the script in php/mysql.
 
 Cannot delete or update a parent row: a foreign key constraint fails
 (`reviewboard`.`accounts_profile`, CONSTRAINT `user_id_refs_id_46e869e2`
 FOREIGN KEY (`user_id`) REFERENCES `auth_user` (`id`))
 
 What sql code would I need to delete, or make sure the user and history are
 deleted properly?
 
 --
 Want to help the Review Board project? Donate today at
 http://www.reviewboard.org/donate/
 Happy user? Let us know at http://www.reviewboard.org/users/
 -~--~~~~--~~--~--~---
 To unsubscribe from this group, send email to
 reviewboard+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/reviewboard?hl=en
 
 -- 
 Want to help the Review Board project? Donate today at 
 http://www.reviewboard.org/donate/
 Happy user? Let us know at http://www.reviewboard.org/users/
 -~--~~~~--~~--~--~---
 To unsubscribe from this group, send email to 
 reviewboard+unsubscr...@googlegroups.com
 For more options, visit this group at 
 http://groups.google.com/group/reviewboard?hl=en
 
 

-- 
Want to help the Review Board project? Donate today at 
http://www.reviewboard.org/donate/
Happy user? Let us know at http://www.reviewboard.org/users/
-~--~~~~--~~--~--~---
To unsubscribe from this group, send email to 
reviewboard+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/reviewboard?hl=en