diff options
-rw-r--r-- | ChangeLog | 1 | ||||
-rw-r--r-- | app/Schema/Mysql.php | 21 | ||||
-rw-r--r-- | app/Schema/Postgres.php | 23 | ||||
-rw-r--r-- | tests/units/Model/TaskCreationTest.php | 14 |
4 files changed, 56 insertions, 3 deletions
@@ -54,6 +54,7 @@ Bug fixes: * Fix Mysql error about gitlab_id when creating remote user * Fix subtask timer bug (event called recursively) * Fix Postgres issue "Cardinality violation" when there is multiple "is_milestone_of" links +* Fix issue with due date greater than year 2038 Version 1.0.18 -------------- diff --git a/app/Schema/Mysql.php b/app/Schema/Mysql.php index 92225279..37894dbd 100644 --- a/app/Schema/Mysql.php +++ b/app/Schema/Mysql.php @@ -6,7 +6,26 @@ use PDO; use Core\Security; use Model\Link; -const VERSION = 89; +const VERSION = 90; + +function version_90($pdo) +{ + $pdo->exec("ALTER TABLE tasks MODIFY date_due BIGINT"); + $pdo->exec("ALTER TABLE tasks MODIFY date_creation BIGINT"); + $pdo->exec("ALTER TABLE tasks MODIFY date_completed BIGINT"); + $pdo->exec("ALTER TABLE tasks MODIFY date_started BIGINT"); + $pdo->exec("ALTER TABLE tasks MODIFY date_moved BIGINT"); + $pdo->exec("ALTER TABLE comments MODIFY date_creation BIGINT"); + $pdo->exec("ALTER TABLE last_logins MODIFY date_creation BIGINT"); + $pdo->exec("ALTER TABLE project_activities MODIFY date_creation BIGINT"); + $pdo->exec("ALTER TABLE projects MODIFY last_modified BIGINT"); + $pdo->exec("ALTER TABLE remember_me MODIFY date_creation BIGINT"); + $pdo->exec('ALTER TABLE files MODIFY `date` BIGINT'); + $pdo->exec('ALTER TABLE transitions MODIFY `date` BIGINT'); + $pdo->exec('ALTER TABLE subtask_time_tracking MODIFY `start` BIGINT'); + $pdo->exec('ALTER TABLE subtask_time_tracking MODIFY `end` BIGINT'); + $pdo->exec('ALTER TABLE users MODIFY `lock_expiration_date` BIGINT'); +} function version_89($pdo) { diff --git a/app/Schema/Postgres.php b/app/Schema/Postgres.php index d55297a9..2a446e40 100644 --- a/app/Schema/Postgres.php +++ b/app/Schema/Postgres.php @@ -6,7 +6,26 @@ use PDO; use Core\Security; use Model\Link; -const VERSION = 69; +const VERSION = 70; + +function version_70($pdo) +{ + $pdo->exec("ALTER TABLE tasks ALTER COLUMN date_due TYPE BIGINT"); + $pdo->exec("ALTER TABLE tasks ALTER COLUMN date_creation TYPE BIGINT"); + $pdo->exec("ALTER TABLE tasks ALTER COLUMN date_completed TYPE BIGINT"); + $pdo->exec("ALTER TABLE tasks ALTER COLUMN date_started TYPE BIGINT"); + $pdo->exec("ALTER TABLE tasks ALTER COLUMN date_moved TYPE BIGINT"); + $pdo->exec("ALTER TABLE comments ALTER COLUMN date_creation TYPE BIGINT"); + $pdo->exec("ALTER TABLE last_logins ALTER COLUMN date_creation TYPE BIGINT"); + $pdo->exec("ALTER TABLE project_activities ALTER COLUMN date_creation TYPE BIGINT"); + $pdo->exec("ALTER TABLE projects ALTER COLUMN last_modified TYPE BIGINT"); + $pdo->exec("ALTER TABLE remember_me ALTER COLUMN date_creation TYPE BIGINT"); + $pdo->exec('ALTER TABLE files ALTER COLUMN "date" TYPE BIGINT'); + $pdo->exec('ALTER TABLE transitions ALTER COLUMN "date" TYPE BIGINT'); + $pdo->exec('ALTER TABLE subtask_time_tracking ALTER COLUMN "start" TYPE BIGINT'); + $pdo->exec('ALTER TABLE subtask_time_tracking ALTER COLUMN "end" TYPE BIGINT'); + $pdo->exec('ALTER TABLE users ALTER COLUMN "lock_expiration_date" TYPE BIGINT'); +} function version_69($pdo) { @@ -33,7 +52,7 @@ function version_69($pdo) $pdo->exec('CREATE UNIQUE INDEX user_has_notification_types_user_idx ON user_has_notification_types(user_id, notification_type)'); // Migrate people who have notification enabled before - $rq = $pdo->prepare('SELECT id FROM users WHERE notifications_enabled=1'); + $rq = $pdo->prepare("SELECT id FROM users WHERE notifications_enabled='1'"); $rq->execute(); $user_ids = $rq->fetchAll(PDO::FETCH_COLUMN, 0); diff --git a/tests/units/Model/TaskCreationTest.php b/tests/units/Model/TaskCreationTest.php index f292c7f1..2a9ced2d 100644 --- a/tests/units/Model/TaskCreationTest.php +++ b/tests/units/Model/TaskCreationTest.php @@ -413,4 +413,18 @@ class TaskCreationTest extends Base $this->assertNotEmpty($task); $this->assertEquals('orange', $task['color_id']); } + + public function testDueDateYear2038TimestampBug() + { + $p = new Project($this->container); + $tc = new TaskCreation($this->container); + $tf = new TaskFinder($this->container); + + $this->assertEquals(1, $p->create(array('name' => 'test'))); + $this->assertEquals(1, $tc->create(array('project_id' => 1, 'title' => 'test', 'date_due' => strtotime('2050-01-10 12:30')))); + + $task = $tf->getById(1); + $this->assertNotEmpty($task); + $this->assertEquals('2050-01-10 12:30', date('Y-m-d H:i', $task['date_due'])); + } } |