diff options
author | Frédéric Guillot <fred@kanboard.net> | 2014-08-30 14:08:46 -0800 |
---|---|---|
committer | Frédéric Guillot <fred@kanboard.net> | 2014-08-30 14:08:46 -0800 |
commit | 9194a2604d79ef97994d01c35fb454f745b5412c (patch) | |
tree | 365dd4294e536c440610bee4f07a1bffb00d00eb /app/Schema | |
parent | e1eba08398c6c6ece684f9db6dedb0dff5d43071 (diff) |
Projects management refactoring
Diffstat (limited to 'app/Schema')
-rw-r--r-- | app/Schema/Mysql.php | 7 | ||||
-rw-r--r-- | app/Schema/Postgres.php | 7 | ||||
-rw-r--r-- | app/Schema/Sqlite.php | 20 |
3 files changed, 18 insertions, 16 deletions
diff --git a/app/Schema/Mysql.php b/app/Schema/Mysql.php index 8f3ae5a1..ca4bbbae 100644 --- a/app/Schema/Mysql.php +++ b/app/Schema/Mysql.php @@ -4,7 +4,12 @@ namespace Schema; use Core\Security; -const VERSION = 23; +const VERSION = 24; + +function version_24($pdo) +{ + $pdo->exec("ALTER TABLE projects ADD COLUMN is_public TINYINT(1) DEFAULT '0'"); +} function version_23($pdo) { diff --git a/app/Schema/Postgres.php b/app/Schema/Postgres.php index ce77a4ed..ac27f786 100644 --- a/app/Schema/Postgres.php +++ b/app/Schema/Postgres.php @@ -4,7 +4,12 @@ namespace Schema; use Core\Security; -const VERSION = 4; +const VERSION = 5; + +function version_5($pdo) +{ + $pdo->exec("ALTER TABLE projects ADD COLUMN is_public BOOLEAN DEFAULT '0'"); +} function version_4($pdo) { diff --git a/app/Schema/Sqlite.php b/app/Schema/Sqlite.php index c3a3f10e..fed9aaf8 100644 --- a/app/Schema/Sqlite.php +++ b/app/Schema/Sqlite.php @@ -4,7 +4,12 @@ namespace Schema; use Core\Security; -const VERSION = 23; +const VERSION = 24; + +function version_24($pdo) +{ + $pdo->exec('ALTER TABLE projects ADD COLUMN is_public INTEGER DEFAULT "0"'); +} function version_23($pdo) { @@ -238,19 +243,6 @@ function version_4($pdo) function version_3($pdo) { $pdo->exec('ALTER TABLE projects ADD COLUMN token TEXT'); - - // For each existing project, assign a different token - $rq = $pdo->prepare("SELECT id FROM projects WHERE token IS NULL"); - $rq->execute(); - $results = $rq->fetchAll(\PDO::FETCH_ASSOC); - - if ($results !== false) { - - foreach ($results as &$result) { - $rq = $pdo->prepare('UPDATE projects SET token=? WHERE id=?'); - $rq->execute(array(Security::generateToken(), $result['id'])); - } - } } function version_2($pdo) |