diff options
Diffstat (limited to 'app/Schema')
-rw-r--r-- | app/Schema/Mysql.php | 27 | ||||
-rw-r--r-- | app/Schema/Postgres.php | 26 | ||||
-rw-r--r-- | app/Schema/Sqlite.php | 26 |
3 files changed, 76 insertions, 3 deletions
diff --git a/app/Schema/Mysql.php b/app/Schema/Mysql.php index 0c932104..769a7425 100644 --- a/app/Schema/Mysql.php +++ b/app/Schema/Mysql.php @@ -6,7 +6,32 @@ use PDO; use Core\Security; use Model\Link; -const VERSION = 77; +const VERSION = 79; + +function version_79($pdo) +{ + $pdo->exec(" + CREATE TABLE project_daily_stats ( + id INT NOT NULL AUTO_INCREMENT, + day CHAR(10) NOT NULL, + project_id INT NOT NULL, + avg_lead_time INT NOT NULL DEFAULT 0, + avg_cycle_time INT NOT NULL DEFAULT 0, + PRIMARY KEY(id), + FOREIGN KEY(project_id) REFERENCES projects(id) ON DELETE CASCADE + ) ENGINE=InnoDB CHARSET=utf8 + "); + + $pdo->exec('CREATE UNIQUE INDEX project_daily_stats_idx ON project_daily_stats(day, project_id)'); + + $pdo->exec('RENAME TABLE project_daily_summaries TO project_daily_column_stats'); +} + +function version_78($pdo) +{ + $pdo->exec("ALTER TABLE project_integrations ADD COLUMN slack_webhook_channel VARCHAR(255) DEFAULT ''"); + $pdo->exec("INSERT INTO settings VALUES ('integration_slack_webhook_channel', '')"); +} function version_77($pdo) { diff --git a/app/Schema/Postgres.php b/app/Schema/Postgres.php index a3309068..fca87766 100644 --- a/app/Schema/Postgres.php +++ b/app/Schema/Postgres.php @@ -6,7 +6,31 @@ use PDO; use Core\Security; use Model\Link; -const VERSION = 57; +const VERSION = 59; + +function version_59($pdo) +{ + $pdo->exec(" + CREATE TABLE project_daily_stats ( + id SERIAL PRIMARY KEY, + day CHAR(10) NOT NULL, + project_id INTEGER NOT NULL, + avg_lead_time INTEGER NOT NULL DEFAULT 0, + avg_cycle_time INTEGER NOT NULL DEFAULT 0, + FOREIGN KEY(project_id) REFERENCES projects(id) ON DELETE CASCADE + ) + "); + + $pdo->exec('CREATE UNIQUE INDEX project_daily_stats_idx ON project_daily_stats(day, project_id)'); + + $pdo->exec('ALTER TABLE project_daily_summaries RENAME TO project_daily_column_stats'); +} + +function version_58($pdo) +{ + $pdo->exec("ALTER TABLE project_integrations ADD COLUMN slack_webhook_channel VARCHAR(255) DEFAULT ''"); + $pdo->exec("INSERT INTO settings VALUES ('integration_slack_webhook_channel', '')"); +} function version_57($pdo) { diff --git a/app/Schema/Sqlite.php b/app/Schema/Sqlite.php index c3bbbac9..9981e72f 100644 --- a/app/Schema/Sqlite.php +++ b/app/Schema/Sqlite.php @@ -6,7 +6,31 @@ use Core\Security; use PDO; use Model\Link; -const VERSION = 73; +const VERSION = 75; + +function version_75($pdo) +{ + $pdo->exec(" + CREATE TABLE project_daily_stats ( + id INTEGER PRIMARY KEY, + day TEXT NOT NULL, + project_id INTEGER NOT NULL, + avg_lead_time INTEGER NOT NULL DEFAULT 0, + avg_cycle_time INTEGER NOT NULL DEFAULT 0, + FOREIGN KEY(project_id) REFERENCES projects(id) ON DELETE CASCADE + ) + "); + + $pdo->exec('CREATE UNIQUE INDEX project_daily_stats_idx ON project_daily_stats(day, project_id)'); + + $pdo->exec('ALTER TABLE project_daily_summaries RENAME TO project_daily_column_stats'); +} + +function version_74($pdo) +{ + $pdo->exec("ALTER TABLE project_integrations ADD COLUMN slack_webhook_channel TEXT DEFAULT ''"); + $pdo->exec("INSERT INTO settings VALUES ('integration_slack_webhook_channel', '')"); +} function version_73($pdo) { |