diff options
author | Frédéric Guillot <fred@kanboard.net> | 2017-03-29 22:44:11 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-03-29 22:44:11 -0400 |
commit | 99015d08fa194c5b8145f5d1315d61ebc20bd7a3 (patch) | |
tree | c9ece15ed4590af2413f1bdba16837be0902f3bd /app/Schema | |
parent | 7ab70c4019f8c5603612c9609d9964ed0589159b (diff) | |
parent | b4c6b2ff9979e18912449c445182c0d5b83423cc (diff) |
Merge pull request #3164
update to sqlite schema - fixing existing table
Diffstat (limited to 'app/Schema')
-rw-r--r-- | app/Schema/Sqlite.php | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/app/Schema/Sqlite.php b/app/Schema/Sqlite.php index 3b2feccc..04a5d050 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) { |