From 264b5526035be61c043a5314baa0e07e8f3f8216 Mon Sep 17 00:00:00 2001 From: Frederic Guillot Date: Fri, 2 Oct 2015 21:58:00 -0400 Subject: Add custom filters (refactoring of pull-request #1312) --- app/Schema/Mysql.php | 19 ++++++++++++++++++- app/Schema/Postgres.php | 16 +++++++++++++++- app/Schema/Sqlite.php | 16 +++++++++++++++- 3 files changed, 48 insertions(+), 3 deletions(-) (limited to 'app/Schema') diff --git a/app/Schema/Mysql.php b/app/Schema/Mysql.php index c146eb0c..a1cef344 100644 --- a/app/Schema/Mysql.php +++ b/app/Schema/Mysql.php @@ -6,7 +6,24 @@ use PDO; use Core\Security; use Model\Link; -const VERSION = 87; +const VERSION = 88; + +function version_88($pdo) +{ + $pdo->exec(" + CREATE TABLE custom_filters ( + id INT NOT NULL AUTO_INCREMENT, + filter VARCHAR(100) NOT NULL, + project_id INT NOT NULL, + user_id INT NOT NULL, + name VARCHAR(100) NOT NULL, + is_shared TINYINT(1) DEFAULT 0, + PRIMARY KEY(id), + FOREIGN KEY(project_id) REFERENCES projects(id) ON DELETE CASCADE, + FOREIGN KEY(user_id) REFERENCES users(id) ON DELETE CASCADE + ) ENGINE=InnoDB CHARSET=utf8 + "); +} function version_87($pdo) { diff --git a/app/Schema/Postgres.php b/app/Schema/Postgres.php index 695d8f1f..f7263e75 100644 --- a/app/Schema/Postgres.php +++ b/app/Schema/Postgres.php @@ -6,7 +6,21 @@ use PDO; use Core\Security; use Model\Link; -const VERSION = 67; +const VERSION = 68; + +function version_68($pdo) +{ + $pdo->exec(" + CREATE TABLE custom_filters ( + id SERIAL PRIMARY KEY, + filter VARCHAR(100) NOT NULL, + project_id INTEGER NOT NULL, + user_id INTEGER NOT NULL, + name VARCHAR(100) NOT NULL, + is_shared BOOLEAN DEFAULT '0' + ) + "); +} function version_67($pdo) { diff --git a/app/Schema/Sqlite.php b/app/Schema/Sqlite.php index 26ad96c7..064d0f3c 100644 --- a/app/Schema/Sqlite.php +++ b/app/Schema/Sqlite.php @@ -6,7 +6,21 @@ use Core\Security; use PDO; use Model\Link; -const VERSION = 83; +const VERSION = 84; + +function version_84($pdo) +{ + $pdo->exec(" + CREATE TABLE custom_filters ( + id INTEGER PRIMARY KEY, + filter TEXT NOT NULL, + project_id INTEGER NOT NULL, + user_id INTEGER NOT NULL, + name TEXT NOT NULL, + is_shared INTEGER DEFAULT 0 + ) + "); +} function version_83($pdo) { -- cgit v1.2.3