summaryrefslogtreecommitdiff
path: root/app/Schema/Postgres.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/Postgres.php
parentb6b733b22f9e9f38786166c1274b135a99bce02a (diff)
Change comments table structure (drop foreign key on user_id)
Diffstat (limited to 'app/Schema/Postgres.php')
-rw-r--r--app/Schema/Postgres.php11
1 files changed, 10 insertions, 1 deletions
diff --git a/app/Schema/Postgres.php b/app/Schema/Postgres.php
index a8b76399..e32b0b9b 100644
--- a/app/Schema/Postgres.php
+++ b/app/Schema/Postgres.php
@@ -6,7 +6,16 @@ use PDO;
use Core\Security;
use Model\Link;
-const VERSION = 54;
+const VERSION = 55;
+
+function version_55($pdo)
+{
+ $pdo->exec('ALTER TABLE comments DROP CONSTRAINT IF EXISTS comments_user_id_fkey');
+ $pdo->exec("ALTER TABLE comments ALTER COLUMN task_id SET NOT NULL");
+ $pdo->exec("ALTER TABLE comments ALTER COLUMN user_id SET DEFAULT 0");
+ $pdo->exec('ALTER TABLE comments RENAME COLUMN "date" TO "date_creation"');
+ $pdo->exec("ALTER TABLE comments ALTER COLUMN date_creation SET NOT NULL");
+}
function version_54($pdo)
{