summaryrefslogtreecommitdiff
path: root/app/Schema/Sqlite.php
diff options
context:
space:
mode:
authorFrédéric Guillot <fred@kanboard.net>2014-12-31 12:37:15 -0500
committerFrédéric Guillot <fred@kanboard.net>2014-12-31 12:37:15 -0500
commit772804add8095eea9b3ec2a832c2f82fbb9a6fd5 (patch)
tree782a414d15f9091d04bcf3960a957f952958e548 /app/Schema/Sqlite.php
parent66f150d887a34d2b51ff14f22d0fd41a34f8cc77 (diff)
Acl refactoring
Diffstat (limited to 'app/Schema/Sqlite.php')
-rw-r--r--app/Schema/Sqlite.php26
1 files changed, 25 insertions, 1 deletions
diff --git a/app/Schema/Sqlite.php b/app/Schema/Sqlite.php
index 39377a91..39a40ace 100644
--- a/app/Schema/Sqlite.php
+++ b/app/Schema/Sqlite.php
@@ -5,7 +5,31 @@ namespace Schema;
use Core\Security;
use PDO;
-const VERSION = 38;
+const VERSION = 39;
+
+function version_39($pdo)
+{
+ // Avoid some full table scans
+ $pdo->exec('CREATE INDEX users_admin_idx ON users(is_admin)');
+ $pdo->exec('CREATE INDEX columns_project_idx ON columns(project_id)');
+ $pdo->exec('CREATE INDEX tasks_project_idx ON tasks(project_id)');
+ $pdo->exec('CREATE INDEX swimlanes_project_idx ON swimlanes(project_id)');
+ $pdo->exec('CREATE INDEX categories_project_idx ON project_has_categories(project_id)');
+ $pdo->exec('CREATE INDEX subtasks_task_idx ON task_has_subtasks(task_id)');
+ $pdo->exec('CREATE INDEX files_task_idx ON task_has_files(task_id)');
+ $pdo->exec('CREATE INDEX comments_task_idx ON comments(task_id)');
+
+ // Set the ownership for all private projects
+ $rq = $pdo->prepare('SELECT id FROM projects WHERE is_private=1');
+ $rq->execute();
+ $project_ids = $rq->fetchAll(PDO::FETCH_COLUMN, 0);
+
+ $rq = $pdo->prepare('UPDATE project_has_users SET is_owner=1 WHERE project_id=?');
+
+ foreach ($project_ids as $project_id) {
+ $rq->execute(array($project_id));
+ }
+}
function version_38($pdo)
{