summaryrefslogtreecommitdiff
path: root/app/Schema/Sqlite.php
diff options
context:
space:
mode:
authorFrederic Guillot <fred@kanboard.net>2015-06-20 17:53:49 -0400
committerFrederic Guillot <fred@kanboard.net>2015-06-20 17:53:49 -0400
commit22b26d0b4d68f0492275ec93eb4df1a975a8fc80 (patch)
treea588fd826ce48ea6c7ce6f3da3259f8ea6204726 /app/Schema/Sqlite.php
parentb6b733b22f9e9f38786166c1274b135a99bce02a (diff)
Change comments table structure (drop foreign key on user_id)
Diffstat (limited to 'app/Schema/Sqlite.php')
-rw-r--r--app/Schema/Sqlite.php29
1 files changed, 28 insertions, 1 deletions
diff --git a/app/Schema/Sqlite.php b/app/Schema/Sqlite.php
index 6ad7f34a..ebc3b064 100644
--- a/app/Schema/Sqlite.php
+++ b/app/Schema/Sqlite.php
@@ -6,7 +6,34 @@ use Core\Security;
use PDO;
use Model\Link;
-const VERSION = 71;
+const VERSION = 72;
+
+function version_72($pdo)
+{
+ $pdo->exec(
+ 'ALTER TABLE comments RENAME TO comments_bak'
+ );
+
+ $pdo->exec(
+ 'CREATE TABLE comments (
+ id INTEGER PRIMARY KEY,
+ task_id INTEGER NOT NULL,
+ user_id INTEGER DEFAULT 0,
+ date_creation INTEGER NOT NULL,
+ comment TEXT NOT NULL,
+ reference VARCHAR(50),
+ FOREIGN KEY(task_id) REFERENCES tasks(id) ON DELETE CASCADE
+ )'
+ );
+
+ $pdo->exec(
+ 'INSERT INTO comments SELECT * FROM comments_bak'
+ );
+
+ $pdo->exec(
+ 'DROP TABLE comments_bak'
+ );
+}
function version_71($pdo)
{