summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorFrederic Guillot <fred@kanboard.net>2015-10-03 14:09:52 -0400
committerFrederic Guillot <fred@kanboard.net>2015-10-03 14:09:52 -0400
commitaeab662d65cdadc044b89c332591b1f1d5b90823 (patch)
tree2f6ef1541b70aa0bc1feb03a5e548bedb6e19bae /app
parenta41d580a464544d8cbba007802bcc14a3627c1ba (diff)
Fix bug with due date greater than year 2038
See: https://en.wikipedia.org/wiki/Year_2038_problem
Diffstat (limited to 'app')
-rw-r--r--app/Schema/Mysql.php21
-rw-r--r--app/Schema/Postgres.php23
2 files changed, 41 insertions, 3 deletions
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);