summaryrefslogtreecommitdiff
path: root/app/Schema
diff options
context:
space:
mode:
authorpalica <pavol.cupka@gmail.com>2017-03-29 08:53:23 +0200
committerGitHub <noreply@github.com>2017-03-29 08:53:23 +0200
commitb4c6b2ff9979e18912449c445182c0d5b83423cc (patch)
tree20295d44e5468862003d37ce918dd49e1f27c876 /app/Schema
parenta308f92c03cf4bcc304f05dc387ebd210732491e (diff)
update to sqlite schema - fixing existing table
table project_activities contains a typo in schema, this corrects the typo on existing installations
Diffstat (limited to 'app/Schema')
-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 2d35b99e..8c7e27fb 100644
--- a/app/Schema/Sqlite.php
+++ b/app/Schema/Sqlite.php
@@ -8,7 +8,34 @@ use Kanboard\Core\Security\Token;
use Kanboard\Core\Security\Role;
use PDO;
-const VERSION = 112;
+const VERSION = 113;
+
+function version_113(PDO $pdo)
+{
+ $pdo->exec(
+ 'ALTER TABLE project_activities RENAME TO project_activities_bak'
+ );
+ $pdo->exec("
+ CREATE TABLE project_activities (
+ id INTEGER PRIMARY KEY,
+ date_creation INTEGER NOT NULL,
+ event_name TEXT NOT NULL,
+ creator_id INTEGER NOT NULL,
+ project_id INTEGER NOT NULL,
+ task_id INTEGER NOT NULL,
+ data TEXT,
+ FOREIGN KEY(creator_id) REFERENCES users(id) ON DELETE CASCADE,
+ FOREIGN KEY(project_id) REFERENCES projects(id) ON DELETE CASCADE,
+ FOREIGN KEY(task_id) REFERENCES tasks(id) ON DELETE CASCADE
+ )
+ ");
+ $pdo->exec(
+ 'INSERT INTO project_activities SELECT * FROM project_activities_bak'
+ );
+ $pdo->exec(
+ 'DROP TABLE project_activities_bak'
+ );
+}
function version_112(PDO $pdo)
{