diff options
Diffstat (limited to 'app/Schema')
-rw-r--r-- | app/Schema/Mysql.php | 21 | ||||
-rw-r--r-- | app/Schema/Sqlite.php | 22 |
2 files changed, 38 insertions, 5 deletions
diff --git a/app/Schema/Mysql.php b/app/Schema/Mysql.php index d3b111f9..5c7e256f 100644 --- a/app/Schema/Mysql.php +++ b/app/Schema/Mysql.php @@ -2,7 +2,24 @@ namespace Schema; -const VERSION = 17; +const VERSION = 18; + +function version_18($pdo) +{ + $pdo->exec(" + CREATE TABLE task_has_subtasks ( + id INT NOT NULL AUTO_INCREMENT, + title VARCHAR(255), + status INT DEFAULT 0, + time_estimated INT DEFAULT 0, + time_spent INT DEFAULT 0, + task_id INT, + user_id INT, + PRIMARY KEY (id), + FOREIGN KEY(task_id) REFERENCES tasks(id) ON DELETE CASCADE + ) ENGINE=InnoDB CHARSET=utf8" + ); +} function version_17($pdo) { @@ -246,6 +263,6 @@ function version_1($pdo) $pdo->exec(" INSERT INTO config (webhooks_token) - VALUES ('".\Model\Base::generateToken()."') + VALUES ('".\Core\Security::generateToken()."') "); } diff --git a/app/Schema/Sqlite.php b/app/Schema/Sqlite.php index 94ef0316..bfe81c13 100644 --- a/app/Schema/Sqlite.php +++ b/app/Schema/Sqlite.php @@ -2,7 +2,23 @@ namespace Schema; -const VERSION = 17; +const VERSION = 18; + +function version_18($pdo) +{ + $pdo->exec(" + CREATE TABLE task_has_subtasks ( + id INTEGER PRIMARY KEY, + title TEXT COLLATE NOCASE, + status INTEGER DEFAULT 0, + time_estimated INTEGER DEFAULT 0, + time_spent INTEGER DEFAULT 0, + task_id INTEGER, + user_id INTEGER, + FOREIGN KEY(task_id) REFERENCES tasks(id) ON DELETE CASCADE + )" + ); +} function version_17($pdo) { @@ -193,7 +209,7 @@ function version_3($pdo) foreach ($results as &$result) { $rq = $pdo->prepare('UPDATE projects SET token=? WHERE id=?'); - $rq->execute(array(\Model\Base::generateToken(), $result['id'])); + $rq->execute(array(\Core\Security::generateToken(), $result['id'])); } } } @@ -268,6 +284,6 @@ function version_1($pdo) $pdo->exec(" INSERT INTO config (language, webhooks_token) - VALUES ('en_US', '".\Model\Base::generateToken()."') + VALUES ('en_US', '".\Core\Security::generateToken()."') "); } |