summaryrefslogtreecommitdiff
path: root/schemas/sqlite.php
diff options
context:
space:
mode:
authorFrédéric Guillot <fguillot@users.noreply.github.com>2014-04-10 20:20:25 -0400
committerFrédéric Guillot <fguillot@users.noreply.github.com>2014-04-10 20:20:25 -0400
commit19dec249aa483c59ab6b74fddc7f63fb28cb8d5b (patch)
tree8c1ca9b77298da74359ac9f6bf084cb1b706f8ea /schemas/sqlite.php
parentc94d5f4afaedc679755be4a4fc0d33996b61b797 (diff)
Fixed invalid constraint for comments table in sqlite and mysql schema
Diffstat (limited to 'schemas/sqlite.php')
-rw-r--r--schemas/sqlite.php27
1 files changed, 27 insertions, 0 deletions
diff --git a/schemas/sqlite.php b/schemas/sqlite.php
index 8e5698f5..26ae09f7 100644
--- a/schemas/sqlite.php
+++ b/schemas/sqlite.php
@@ -2,6 +2,33 @@
namespace Schema;
+function version_11($pdo)
+{
+ $pdo->exec(
+ 'ALTER TABLE comments RENAME TO comments_bak'
+ );
+
+ $pdo->exec(
+ 'CREATE TABLE comments (
+ id INTEGER PRIMARY KEY,
+ task_id INTEGER,
+ user_id INTEGER,
+ date INTEGER,
+ comment TEXT,
+ FOREIGN KEY(task_id) REFERENCES tasks(id) ON DELETE CASCADE,
+ FOREIGN KEY(user_id) REFERENCES users(id) ON DELETE CASCADE
+ )'
+ );
+
+ $pdo->exec(
+ 'INSERT INTO comments SELECT * FROM comments_bak'
+ );
+
+ $pdo->exec(
+ 'DROP TABLE comments_bak'
+ );
+}
+
function version_10($pdo)
{
$pdo->exec(