On 18.02.2011 03:24, ben@electricembers.net wrote:
SELECT user_id FROM users WHERE username LIKE '$ARGV' UPDATE identities SET del=1 WHERE user_id = '$user_id' DELETE FROM cache WHERE user_id = '$user_id' UPDATE contacts SET del=1 WHERE user_id = '$user_id' UPDATE contactgroups SET del=1 WHERE user_id = '$user_id' DELETE FROM messages WHERE user_id = '$user_id'
??DELETE FROM users WHERE username = '$ARGV' LIMIT 1??
This last line is where I get stuck because I don't really want to delete it, but there is no del column to mark. . .
When you delete a user record all related records in other tables will be auto-removed because of foreign key constraints.
We would probably need to add users.del column, but there will be a problem with uniqueness constraint (or creation of the same user will fail until you remove the original record). I don't know if this is a real problem. Then all you need will be just to set this column.