diff options
author | Frederic Guillot <fred@kanboard.net> | 2015-06-20 17:53:49 -0400 |
---|---|---|
committer | Frederic Guillot <fred@kanboard.net> | 2015-06-20 17:53:49 -0400 |
commit | 22b26d0b4d68f0492275ec93eb4df1a975a8fc80 (patch) | |
tree | a588fd826ce48ea6c7ce6f3da3259f8ea6204726 /app/Model/User.php | |
parent | b6b733b22f9e9f38786166c1274b135a99bce02a (diff) |
Change comments table structure (drop foreign key on user_id)
Diffstat (limited to 'app/Model/User.php')
-rw-r--r-- | app/Model/User.php | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/app/Model/User.php b/app/Model/User.php index 83cf065b..726978e5 100644 --- a/app/Model/User.php +++ b/app/Model/User.php @@ -302,11 +302,21 @@ class User extends Base { return $this->db->transaction(function ($db) use ($user_id) { - // All assigned tasks are now unassigned + // All assigned tasks are now unassigned (no foreign key) if (! $db->table(Task::TABLE)->eq('owner_id', $user_id)->update(array('owner_id' => 0))) { return false; } + // All assigned subtasks are now unassigned (no foreign key) + if (! $db->table(Subtask::TABLE)->eq('user_id', $user_id)->update(array('user_id' => 0))) { + return false; + } + + // All comments are not assigned anymore (no foreign key) + if (! $db->table(Comment::TABLE)->eq('user_id', $user_id)->update(array('user_id' => 0))) { + return false; + } + // All private projects are removed $project_ids = $db->table(Project::TABLE) ->eq('is_private', 1) |