summaryrefslogtreecommitdiff
path: root/app/Schema
diff options
context:
space:
mode:
Diffstat (limited to 'app/Schema')
-rw-r--r--app/Schema/Mysql.php58
-rw-r--r--app/Schema/Postgres.php57
-rw-r--r--app/Schema/Sqlite.php55
3 files changed, 165 insertions, 5 deletions
diff --git a/app/Schema/Mysql.php b/app/Schema/Mysql.php
index a78ffacf..f0e0d6b2 100644
--- a/app/Schema/Mysql.php
+++ b/app/Schema/Mysql.php
@@ -6,7 +6,61 @@ use PDO;
use Core\Security;
use Model\Link;
-const VERSION = 54;
+const VERSION = 59;
+
+function version_59($pdo)
+{
+ $rq = $pdo->prepare('INSERT INTO settings VALUES (?, ?)');
+ $rq->execute(array('integration_hipchat', '0'));
+ $rq->execute(array('integration_hipchat_api_url', 'https://api.hipchat.com'));
+ $rq->execute(array('integration_hipchat_room_id', ''));
+ $rq->execute(array('integration_hipchat_room_token', ''));
+}
+
+function version_58($pdo)
+{
+ $rq = $pdo->prepare('INSERT INTO settings VALUES (?, ?)');
+ $rq->execute(array('integration_slack_webhook', '0'));
+ $rq->execute(array('integration_slack_webhook_url', ''));
+}
+
+function version_57($pdo)
+{
+ $pdo->exec('CREATE TABLE currencies (`currency` CHAR(3) NOT NULL UNIQUE, `rate` FLOAT DEFAULT 0) ENGINE=InnoDB CHARSET=utf8');
+
+ $rq = $pdo->prepare('INSERT INTO settings VALUES (?, ?)');
+ $rq->execute(array('application_currency', 'USD'));
+}
+
+function version_56($pdo)
+{
+ $pdo->exec('CREATE TABLE transitions (
+ `id` INT NOT NULL AUTO_INCREMENT,
+ `user_id` INT NOT NULL,
+ `project_id` INT NOT NULL,
+ `task_id` INT NOT NULL,
+ `src_column_id` INT NOT NULL,
+ `dst_column_id` INT NOT NULL,
+ `date` INT NOT NULL,
+ `time_spent` INT DEFAULT 0,
+ FOREIGN KEY(src_column_id) REFERENCES columns(id) ON DELETE CASCADE,
+ FOREIGN KEY(dst_column_id) REFERENCES columns(id) ON DELETE CASCADE,
+ FOREIGN KEY(user_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,
+ PRIMARY KEY(id)
+ ) ENGINE=InnoDB CHARSET=utf8');
+
+ $pdo->exec("CREATE INDEX transitions_task_index ON transitions(task_id)");
+ $pdo->exec("CREATE INDEX transitions_project_index ON transitions(project_id)");
+ $pdo->exec("CREATE INDEX transitions_user_index ON transitions(user_id)");
+}
+
+function version_55($pdo)
+{
+ $rq = $pdo->prepare('INSERT INTO settings VALUES (?, ?)');
+ $rq->execute(array('subtask_forecast', '0'));
+}
function version_54($pdo)
{
@@ -85,7 +139,7 @@ function version_50($pdo)
user_id INT NOT NULL,
rate FLOAT DEFAULT 0,
date_effective INTEGER NOT NULL,
- currency TEXT NOT NULL,
+ currency CHAR(3) NOT NULL,
FOREIGN KEY(user_id) REFERENCES users(id) ON DELETE CASCADE,
PRIMARY KEY(id)
) ENGINE=InnoDB CHARSET=utf8");
diff --git a/app/Schema/Postgres.php b/app/Schema/Postgres.php
index 2396000f..f7a0453d 100644
--- a/app/Schema/Postgres.php
+++ b/app/Schema/Postgres.php
@@ -6,7 +6,60 @@ use PDO;
use Core\Security;
use Model\Link;
-const VERSION = 35;
+const VERSION = 40;
+
+function version_40($pdo)
+{
+ $rq = $pdo->prepare('INSERT INTO settings VALUES (?, ?)');
+ $rq->execute(array('integration_hipchat', '0'));
+ $rq->execute(array('integration_hipchat_api_url', 'https://api.hipchat.com'));
+ $rq->execute(array('integration_hipchat_room_id', ''));
+ $rq->execute(array('integration_hipchat_room_token', ''));
+}
+
+function version_39($pdo)
+{
+ $rq = $pdo->prepare('INSERT INTO settings VALUES (?, ?)');
+ $rq->execute(array('integration_slack_webhook', '0'));
+ $rq->execute(array('integration_slack_webhook_url', ''));
+}
+
+function version_38($pdo)
+{
+ $pdo->exec('CREATE TABLE currencies ("currency" CHAR(3) NOT NULL UNIQUE, "rate" REAL DEFAULT 0)');
+
+ $rq = $pdo->prepare('INSERT INTO settings VALUES (?, ?)');
+ $rq->execute(array('application_currency', 'USD'));
+}
+
+function version_37($pdo)
+{
+ $pdo->exec('CREATE TABLE transitions (
+ "id" SERIAL PRIMARY KEY,
+ "user_id" INTEGER NOT NULL,
+ "project_id" INTEGER NOT NULL,
+ "task_id" INTEGER NOT NULL,
+ "src_column_id" INTEGER NOT NULL,
+ "dst_column_id" INTEGER NOT NULL,
+ "date" INTEGER NOT NULL,
+ "time_spent" INTEGER DEFAULT 0,
+ FOREIGN KEY(src_column_id) REFERENCES columns(id) ON DELETE CASCADE,
+ FOREIGN KEY(dst_column_id) REFERENCES columns(id) ON DELETE CASCADE,
+ FOREIGN KEY(user_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("CREATE INDEX transitions_task_index ON transitions(task_id)");
+ $pdo->exec("CREATE INDEX transitions_project_index ON transitions(project_id)");
+ $pdo->exec("CREATE INDEX transitions_user_index ON transitions(user_id)");
+}
+
+function version_36($pdo)
+{
+ $rq = $pdo->prepare('INSERT INTO settings VALUES (?, ?)');
+ $rq->execute(array('subtask_forecast', '0'));
+}
function version_35($pdo)
{
@@ -80,7 +133,7 @@ function version_31($pdo)
user_id INTEGER NOT NULL,
rate REAL DEFAULT 0,
date_effective INTEGER NOT NULL,
- currency TEXT NOT NULL,
+ currency CHAR(3) NOT NULL,
FOREIGN KEY(user_id) REFERENCES users(id) ON DELETE CASCADE
)");
}
diff --git a/app/Schema/Sqlite.php b/app/Schema/Sqlite.php
index 0e0512d0..3ad045e6 100644
--- a/app/Schema/Sqlite.php
+++ b/app/Schema/Sqlite.php
@@ -6,7 +6,60 @@ use Core\Security;
use PDO;
use Model\Link;
-const VERSION = 53;
+const VERSION = 58;
+
+function version_58($pdo)
+{
+ $rq = $pdo->prepare('INSERT INTO settings VALUES (?, ?)');
+ $rq->execute(array('integration_hipchat', '0'));
+ $rq->execute(array('integration_hipchat_api_url', 'https://api.hipchat.com'));
+ $rq->execute(array('integration_hipchat_room_id', ''));
+ $rq->execute(array('integration_hipchat_room_token', ''));
+}
+
+function version_57($pdo)
+{
+ $rq = $pdo->prepare('INSERT INTO settings VALUES (?, ?)');
+ $rq->execute(array('integration_slack_webhook', '0'));
+ $rq->execute(array('integration_slack_webhook_url', ''));
+}
+
+function version_56($pdo)
+{
+ $pdo->exec('CREATE TABLE currencies ("currency" TEXT NOT NULL UNIQUE, "rate" REAL DEFAULT 0)');
+
+ $rq = $pdo->prepare('INSERT INTO settings VALUES (?, ?)');
+ $rq->execute(array('application_currency', 'USD'));
+}
+
+function version_55($pdo)
+{
+ $pdo->exec('CREATE TABLE transitions (
+ "id" INTEGER PRIMARY KEY,
+ "user_id" INTEGER NOT NULL,
+ "project_id" INTEGER NOT NULL,
+ "task_id" INTEGER NOT NULL,
+ "src_column_id" INTEGER NOT NULL,
+ "dst_column_id" INTEGER NOT NULL,
+ "date" INTEGER NOT NULL,
+ "time_spent" INTEGER DEFAULT 0,
+ FOREIGN KEY(src_column_id) REFERENCES columns(id) ON DELETE CASCADE,
+ FOREIGN KEY(dst_column_id) REFERENCES columns(id) ON DELETE CASCADE,
+ FOREIGN KEY(user_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("CREATE INDEX transitions_task_index ON transitions(task_id)");
+ $pdo->exec("CREATE INDEX transitions_project_index ON transitions(project_id)");
+ $pdo->exec("CREATE INDEX transitions_user_index ON transitions(user_id)");
+}
+
+function version_54($pdo)
+{
+ $rq = $pdo->prepare('INSERT INTO settings VALUES (?, ?)');
+ $rq->execute(array('subtask_forecast', '0'));
+}
function version_53($pdo)
{