From da425e4187e5e8e7feb9783c9d75bcaa9fa0c7ec Mon Sep 17 00:00:00 2001 From: Frederic Guillot Date: Sat, 28 Feb 2015 19:54:32 -0500 Subject: Rename subtasks and files tables --- app/Model/File.php | 2 +- app/Model/Subtask.php | 2 +- app/Model/TaskFinder.php | 10 +++++----- 3 files changed, 7 insertions(+), 7 deletions(-) (limited to 'app/Model') diff --git a/app/Model/File.php b/app/Model/File.php index 1b9351db..f069c8cf 100644 --- a/app/Model/File.php +++ b/app/Model/File.php @@ -17,7 +17,7 @@ class File extends Base * * @var string */ - const TABLE = 'task_has_files'; + const TABLE = 'files'; /** * Events diff --git a/app/Model/Subtask.php b/app/Model/Subtask.php index 048594bd..aa4a6f81 100644 --- a/app/Model/Subtask.php +++ b/app/Model/Subtask.php @@ -19,7 +19,7 @@ class Subtask extends Base * * @var string */ - const TABLE = 'task_has_subtasks'; + const TABLE = 'subtasks'; /** * Task "done" status diff --git a/app/Model/TaskFinder.php b/app/Model/TaskFinder.php index 98ece4e1..7216e92a 100644 --- a/app/Model/TaskFinder.php +++ b/app/Model/TaskFinder.php @@ -80,11 +80,11 @@ class TaskFinder extends Base return $this->db ->table(Task::TABLE) ->columns( - '(SELECT count(*) FROM comments WHERE task_id=tasks.id) AS nb_comments', - '(SELECT count(*) FROM task_has_files WHERE task_id=tasks.id) AS nb_files', - '(SELECT count(*) FROM task_has_subtasks WHERE task_id=tasks.id) AS nb_subtasks', - '(SELECT count(*) FROM task_has_subtasks WHERE task_id=tasks.id AND status=2) AS nb_completed_subtasks', - '(SELECT count(*) FROM ' . TaskLink::TABLE . ' WHERE ' . TaskLink::TABLE . '.task_id = tasks.id) AS nb_links', + '(SELECT count(*) FROM '.Comment::TABLE.' WHERE task_id=tasks.id) AS nb_comments', + '(SELECT count(*) FROM '.File::TABLE.' WHERE task_id=tasks.id) AS nb_files', + '(SELECT count(*) FROM '.Subtask::TABLE.' WHERE '.Subtask::TABLE.'.task_id=tasks.id) AS nb_subtasks', + '(SELECT count(*) FROM '.Subtask::TABLE.' WHERE '.Subtask::TABLE.'.task_id=tasks.id AND status=2) AS nb_completed_subtasks', + '(SELECT count(*) FROM '.TaskLink::TABLE.' WHERE '.TaskLink::TABLE.'.task_id = tasks.id) AS nb_links', 'tasks.id', 'tasks.reference', 'tasks.title', -- cgit v1.2.3