From b4c6b2ff9979e18912449c445182c0d5b83423cc Mon Sep 17 00:00:00 2001 From: palica Date: Wed, 29 Mar 2017 08:53:23 +0200 Subject: update to sqlite schema - fixing existing table table project_activities contains a typo in schema, this corrects the typo on existing installations --- app/Schema/Sqlite.php | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) (limited to 'app/Schema') 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) { -- cgit v1.2.3