diff options
Diffstat (limited to 'models')
-rw-r--r-- | models/base.php | 2 | ||||
-rw-r--r-- | models/schema.php | 5 | ||||
-rw-r--r-- | models/task.php | 6 |
3 files changed, 11 insertions, 2 deletions
diff --git a/models/base.php b/models/base.php index e512e9db..0a565f51 100644 --- a/models/base.php +++ b/models/base.php @@ -17,7 +17,7 @@ require __DIR__.'/schema.php'; abstract class Base { const APP_VERSION = 'master'; - const DB_VERSION = 4; + const DB_VERSION = 5; const DB_FILENAME = 'data/db.sqlite'; private static $dbInstance = null; diff --git a/models/schema.php b/models/schema.php index 66571bbe..e06271b3 100644 --- a/models/schema.php +++ b/models/schema.php @@ -2,6 +2,11 @@ namespace Schema; +function version_5($pdo) +{ + $pdo->exec("ALTER TABLE tasks ADD column score INTEGER"); +} + function version_4($pdo) { $pdo->exec("ALTER TABLE config ADD column timezone TEXT DEFAULT 'UTC'"); diff --git a/models/task.php b/models/task.php index e227cc95..e542e8e0 100644 --- a/models/task.php +++ b/models/task.php @@ -40,6 +40,7 @@ class Task extends Base self::TABLE.'.owner_id', self::TABLE.'.position', self::TABLE.'.is_active', + self::TABLE.'.score', \Model\Project::TABLE.'.name AS project_name', \Model\Board::TABLE.'.title AS column_title', \Model\User::TABLE.'.username' @@ -71,6 +72,7 @@ class Task extends Base self::TABLE.'.owner_id', self::TABLE.'.position', self::TABLE.'.is_active', + self::TABLE.'.score', \Model\Board::TABLE.'.title AS column_title', \Model\User::TABLE.'.username' ) @@ -95,7 +97,7 @@ class Task extends Base { return $this->db ->table(self::TABLE) - ->columns('tasks.id', 'title', 'color_id', 'project_id', 'owner_id', 'column_id', 'position', 'users.username') + ->columns('tasks.id', 'title', 'color_id', 'project_id', 'owner_id', 'column_id', 'position', 'score', 'users.username') ->join('users', 'id', 'owner_id') ->eq('project_id', $project_id) ->eq('column_id', $column_id) @@ -179,6 +181,7 @@ class Task extends Base new Validators\Required('column_id', t('The column is required')), new Validators\Integer('column_id', t('This value must be an integer')), new Validators\Integer('owner_id', t('This value must be an integer')), + new Validators\Integer('score', t('This value must be an integer')), new Validators\Required('title', t('The title is required')), new Validators\MaxLength('title', t('The maximum length is %d characters', 200), 200), )); @@ -200,6 +203,7 @@ class Task extends Base new Validators\Required('column_id', t('The column is required')), new Validators\Integer('column_id', t('This value must be an integer')), new Validators\Integer('owner_id', t('This value must be an integer')), + new Validators\Integer('score', t('This value must be an integer')), new Validators\Required('title', t('The title is required')), new Validators\MaxLength('title', t('The maximum length is %d characters', 200), 200), )); |