diff options
Diffstat (limited to 'app/Schema')
-rw-r--r-- | app/Schema/Mysql.php | 165 | ||||
-rw-r--r-- | app/Schema/Postgres.php | 145 | ||||
-rw-r--r-- | app/Schema/Sqlite.php | 175 |
3 files changed, 235 insertions, 250 deletions
diff --git a/app/Schema/Mysql.php b/app/Schema/Mysql.php index 7051bfb4..a021c1cc 100644 --- a/app/Schema/Mysql.php +++ b/app/Schema/Mysql.php @@ -4,11 +4,10 @@ namespace Schema; use PDO; use Kanboard\Core\Security; -use Kanboard\Model\Link; const VERSION = 93; -function version_93($pdo) +function version_93(PDO $pdo) { $pdo->exec(" CREATE TABLE user_has_metadata ( @@ -58,7 +57,7 @@ function version_93($pdo) $pdo->exec("DELETE FROM settings WHERE `option`='integration_slack_webhook_channel'"); } -function version_92($pdo) +function version_92(PDO $pdo) { $pdo->exec(" CREATE TABLE project_has_notification_types ( @@ -72,12 +71,12 @@ function version_92($pdo) "); } -function version_91($pdo) +function version_91(PDO $pdo) { $pdo->exec("ALTER TABLE custom_filters ADD COLUMN `append` TINYINT(1) DEFAULT 0"); } -function version_90($pdo) +function version_90(PDO $pdo) { $pdo->exec("ALTER TABLE tasks MODIFY date_due BIGINT"); $pdo->exec("ALTER TABLE tasks MODIFY date_creation BIGINT"); @@ -96,7 +95,7 @@ function version_90($pdo) $pdo->exec('ALTER TABLE users MODIFY `lock_expiration_date` BIGINT'); } -function version_89($pdo) +function version_89(PDO $pdo) { $pdo->exec(" CREATE TABLE user_has_unread_notifications ( @@ -133,7 +132,7 @@ function version_89($pdo) } } -function version_88($pdo) +function version_88(PDO $pdo) { $pdo->exec(" CREATE TABLE custom_filters ( @@ -150,7 +149,7 @@ function version_88($pdo) "); } -function version_87($pdo) +function version_87(PDO $pdo) { $pdo->exec(" CREATE TABLE plugin_schema_versions ( @@ -161,45 +160,45 @@ function version_87($pdo) "); } -function version_86($pdo) +function version_86(PDO $pdo) { $pdo->exec("ALTER TABLE swimlanes ADD COLUMN description TEXT"); } -function version_85($pdo) +function version_85(PDO $pdo) { $pdo->exec("ALTER TABLE users ADD COLUMN gitlab_id INT"); } -function version_84($pdo) +function version_84(PDO $pdo) { $pdo->exec("ALTER TABLE projects ADD COLUMN start_date VARCHAR(10) DEFAULT ''"); $pdo->exec("ALTER TABLE projects ADD COLUMN end_date VARCHAR(10) DEFAULT ''"); } -function version_83($pdo) +function version_83(PDO $pdo) { $pdo->exec("ALTER TABLE users ADD COLUMN is_project_admin INT DEFAULT 0"); } -function version_82($pdo) +function version_82(PDO $pdo) { $pdo->exec("ALTER TABLE users ADD COLUMN nb_failed_login INT DEFAULT 0"); $pdo->exec("ALTER TABLE users ADD COLUMN lock_expiration_date INT DEFAULT 0"); } -function version_81($pdo) +function version_81(PDO $pdo) { $pdo->exec("INSERT INTO settings VALUES ('subtask_time_tracking', '1')"); $pdo->exec("INSERT INTO settings VALUES ('cfd_include_closed_tasks', '1')"); } -function version_80($pdo) +function version_80(PDO $pdo) { $pdo->exec("INSERT INTO settings VALUES ('default_color', 'yellow')"); } -function version_79($pdo) +function version_79(PDO $pdo) { $pdo->exec(" CREATE TABLE project_daily_stats ( @@ -218,23 +217,23 @@ function version_79($pdo) $pdo->exec('RENAME TABLE project_daily_summaries TO project_daily_column_stats'); } -function version_78($pdo) +function version_78(PDO $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) +function version_77(PDO $pdo) { $pdo->exec('ALTER TABLE users DROP COLUMN `default_project_id`'); } -function version_76($pdo) +function version_76(PDO $pdo) { $pdo->exec("DELETE FROM `settings` WHERE `option`='subtask_time_tracking'"); } -function version_75($pdo) +function version_75(PDO $pdo) { $pdo->exec('ALTER TABLE comments DROP FOREIGN KEY comments_ibfk_2'); $pdo->exec('ALTER TABLE comments MODIFY task_id INT NOT NULL'); @@ -242,7 +241,7 @@ function version_75($pdo) $pdo->exec('ALTER TABLE comments CHANGE COLUMN `date` `date_creation` INT NOT NULL'); } -function version_74($pdo) +function version_74(PDO $pdo) { $pdo->exec('ALTER TABLE project_has_categories MODIFY project_id INT NOT NULL'); $pdo->exec('ALTER TABLE project_has_categories MODIFY name VARCHAR(255) NOT NULL'); @@ -277,17 +276,17 @@ function version_74($pdo) $pdo->exec('ALTER TABLE user_has_notifications MODIFY user_id INT NOT NULL'); } -function version_73($pdo) +function version_73(PDO $pdo) { $pdo->exec("ALTER TABLE users ADD COLUMN notifications_filter INT DEFAULT 4"); } -function version_72($pdo) +function version_72(PDO $pdo) { $pdo->exec('ALTER TABLE files MODIFY name VARCHAR(255)'); } -function version_71($pdo) +function version_71(PDO $pdo) { $rq = $pdo->prepare('INSERT INTO `settings` VALUES (?, ?)'); $rq->execute(array('webhook_url', '')); @@ -296,17 +295,13 @@ function version_71($pdo) $pdo->exec("DELETE FROM `settings` WHERE `option`='webhook_url_task_modification'"); } -function version_70($pdo) +function version_70(PDO $pdo) { $pdo->exec("ALTER TABLE users ADD COLUMN token VARCHAR(255) DEFAULT ''"); } -function version_69($pdo) +function version_69(PDO $pdo) { - $rq = $pdo->prepare("SELECT `value` FROM `settings` WHERE `option`='subtask_forecast'"); - $rq->execute(); - $result = $rq->fetch(PDO::FETCH_ASSOC); - $rq = $pdo->prepare('INSERT INTO settings VALUES (?, ?)'); $rq->execute(array('calendar_user_subtasks_time_tracking', 0)); $rq->execute(array('calendar_user_tasks', 'date_started')); @@ -315,7 +310,7 @@ function version_69($pdo) $pdo->exec("DELETE FROM `settings` WHERE `option`='subtask_forecast'"); } -function version_68($pdo) +function version_68(PDO $pdo) { $rq = $pdo->prepare('INSERT INTO settings VALUES (?, ?)'); $rq->execute(array('integration_jabber', '0')); @@ -335,7 +330,7 @@ function version_68($pdo) $pdo->exec("ALTER TABLE project_integrations ADD COLUMN jabber_room VARCHAR(255) DEFAULT ''"); } -function version_67($pdo) +function version_67(PDO $pdo) { $pdo->exec('ALTER TABLE tasks ADD COLUMN recurrence_status INTEGER NOT NULL DEFAULT 0'); $pdo->exec('ALTER TABLE tasks ADD COLUMN recurrence_trigger INTEGER NOT NULL DEFAULT 0'); @@ -346,12 +341,12 @@ function version_67($pdo) $pdo->exec('ALTER TABLE tasks ADD COLUMN recurrence_child INTEGER'); } -function version_66($pdo) +function version_66(PDO $pdo) { $pdo->exec("ALTER TABLE projects ADD COLUMN identifier VARCHAR(50) DEFAULT ''"); } -function version_65($pdo) +function version_65(PDO $pdo) { $pdo->exec(" CREATE TABLE project_integrations ( @@ -369,36 +364,36 @@ function version_65($pdo) "); } -function version_64($pdo) +function version_64(PDO $pdo) { $pdo->exec('ALTER TABLE project_daily_summaries ADD COLUMN score INT NOT NULL DEFAULT 0'); } -function version_63($pdo) +function version_63(PDO $pdo) { $pdo->exec('ALTER TABLE project_has_categories ADD COLUMN description TEXT'); } -function version_62($pdo) +function version_62(PDO $pdo) { $pdo->exec('ALTER TABLE files ADD COLUMN `date` INT NOT NULL DEFAULT 0'); $pdo->exec('ALTER TABLE files ADD COLUMN `user_id` INT NOT NULL DEFAULT 0'); $pdo->exec('ALTER TABLE files ADD COLUMN `size` INT NOT NULL DEFAULT 0'); } -function version_61($pdo) +function version_61(PDO $pdo) { $pdo->exec('ALTER TABLE users ADD COLUMN twofactor_activated TINYINT(1) DEFAULT 0'); $pdo->exec('ALTER TABLE users ADD COLUMN twofactor_secret CHAR(16)'); } -function version_60($pdo) +function version_60(PDO $pdo) { $rq = $pdo->prepare('INSERT INTO settings VALUES (?, ?)'); $rq->execute(array('integration_gravatar', '0')); } -function version_59($pdo) +function version_59(PDO $pdo) { $rq = $pdo->prepare('INSERT INTO settings VALUES (?, ?)'); $rq->execute(array('integration_hipchat', '0')); @@ -407,14 +402,14 @@ function version_59($pdo) $rq->execute(array('integration_hipchat_room_token', '')); } -function version_58($pdo) +function version_58(PDO $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) +function version_57(PDO $pdo) { $pdo->exec('CREATE TABLE currencies (`currency` CHAR(3) NOT NULL UNIQUE, `rate` FLOAT DEFAULT 0) ENGINE=InnoDB CHARSET=utf8'); @@ -422,7 +417,7 @@ function version_57($pdo) $rq->execute(array('application_currency', 'USD')); } -function version_56($pdo) +function version_56(PDO $pdo) { $pdo->exec('CREATE TABLE transitions ( `id` INT NOT NULL AUTO_INCREMENT, @@ -446,24 +441,24 @@ function version_56($pdo) $pdo->exec("CREATE INDEX transitions_user_index ON transitions(user_id)"); } -function version_55($pdo) +function version_55(PDO $pdo) { $rq = $pdo->prepare('INSERT INTO settings VALUES (?, ?)'); $rq->execute(array('subtask_forecast', '0')); } -function version_54($pdo) +function version_54(PDO $pdo) { $rq = $pdo->prepare('INSERT INTO settings VALUES (?, ?)'); $rq->execute(array('application_stylesheet', '')); } -function version_53($pdo) +function version_53(PDO $pdo) { $pdo->exec("ALTER TABLE subtask_time_tracking ADD COLUMN time_spent FLOAT DEFAULT 0"); } -function version_49($pdo) +function version_49(PDO $pdo) { $pdo->exec('ALTER TABLE subtasks ADD COLUMN position INTEGER DEFAULT 1'); @@ -485,18 +480,18 @@ function version_49($pdo) } } -function version_48($pdo) +function version_48(PDO $pdo) { $pdo->exec('RENAME TABLE task_has_files TO files'); $pdo->exec('RENAME TABLE task_has_subtasks TO subtasks'); } -function version_47($pdo) +function version_47(PDO $pdo) { $pdo->exec('ALTER TABLE projects ADD COLUMN description TEXT'); } -function version_46($pdo) +function version_46(PDO $pdo) { $pdo->exec("CREATE TABLE links ( id INT NOT NULL AUTO_INCREMENT, @@ -534,7 +529,7 @@ function version_46($pdo) $rq->execute(array('is fixed by', 10)); } -function version_45($pdo) +function version_45(PDO $pdo) { $pdo->exec('ALTER TABLE tasks ADD COLUMN date_moved INT DEFAULT 0'); @@ -567,12 +562,12 @@ function version_45($pdo) $pdo->exec("UPDATE tasks SET date_moved = date_creation WHERE date_moved IS NULL OR date_moved = 0"); } -function version_44($pdo) +function version_44(PDO $pdo) { $pdo->exec('ALTER TABLE users ADD COLUMN disable_login_form TINYINT(1) DEFAULT 0'); } -function version_43($pdo) +function version_43(PDO $pdo) { $rq = $pdo->prepare('INSERT INTO settings VALUES (?, ?)'); $rq->execute(array('subtask_restriction', '0')); @@ -592,18 +587,18 @@ function version_43($pdo) "); } -function version_42($pdo) +function version_42(PDO $pdo) { $pdo->exec('ALTER TABLE columns ADD COLUMN description TEXT'); } -function version_41($pdo) +function version_41(PDO $pdo) { $pdo->exec('ALTER TABLE users ADD COLUMN timezone VARCHAR(50)'); $pdo->exec('ALTER TABLE users ADD COLUMN language CHAR(5)'); } -function version_40($pdo) +function version_40(PDO $pdo) { // Avoid some full table scans $pdo->exec('CREATE INDEX users_admin_idx ON users(is_admin)'); @@ -627,13 +622,13 @@ function version_40($pdo) } } -function version_39($pdo) +function version_39(PDO $pdo) { $rq = $pdo->prepare('INSERT INTO settings VALUES (?, ?)'); $rq->execute(array('project_categories', '')); } -function version_38($pdo) +function version_38(PDO $pdo) { $pdo->exec(" CREATE TABLE swimlanes ( @@ -653,17 +648,17 @@ function version_38($pdo) $pdo->exec("ALTER TABLE projects ADD COLUMN show_default_swimlane INT DEFAULT 1"); } -function version_37($pdo) +function version_37(PDO $pdo) { $pdo->exec("ALTER TABLE project_has_users ADD COLUMN is_owner TINYINT(1) DEFAULT '0'"); } -function version_36($pdo) +function version_36(PDO $pdo) { $pdo->exec('ALTER TABLE tasks MODIFY title VARCHAR(255) NOT NULL'); } -function version_35($pdo) +function version_35(PDO $pdo) { $pdo->exec(" CREATE TABLE project_daily_summaries ( @@ -681,12 +676,12 @@ function version_35($pdo) $pdo->exec('CREATE UNIQUE INDEX project_daily_column_stats_idx ON project_daily_summaries(day, project_id, column_id)'); } -function version_34($pdo) +function version_34(PDO $pdo) { $pdo->exec("ALTER TABLE projects ADD COLUMN is_everybody_allowed TINYINT(1) DEFAULT '0'"); } -function version_33($pdo) +function version_33(PDO $pdo) { $pdo->exec(" CREATE TABLE project_activities ( @@ -709,7 +704,7 @@ function version_33($pdo) $pdo->exec('DROP TABLE subtask_has_events'); } -function version_32($pdo) +function version_32(PDO $pdo) { $pdo->exec("ALTER TABLE tasks ADD COLUMN date_started INTEGER"); $pdo->exec("ALTER TABLE tasks ADD COLUMN time_spent FLOAT DEFAULT 0"); @@ -719,18 +714,18 @@ function version_32($pdo) $pdo->exec("ALTER TABLE task_has_subtasks MODIFY time_spent FLOAT"); } -function version_31($pdo) +function version_31(PDO $pdo) { $pdo->exec("ALTER TABLE projects ADD COLUMN is_private TINYINT(1) DEFAULT '0'"); } -function version_30($pdo) +function version_30(PDO $pdo) { $rq = $pdo->prepare('INSERT INTO settings VALUES (?, ?)'); $rq->execute(array('application_date_format', 'm/d/Y')); } -function version_29($pdo) +function version_29(PDO $pdo) { $pdo->exec(" CREATE TABLE settings ( @@ -760,7 +755,7 @@ function version_29($pdo) $pdo->exec('DROP TABLE config'); } -function version_28($pdo) +function version_28(PDO $pdo) { $pdo->exec("ALTER TABLE tasks ADD COLUMN reference VARCHAR(50) DEFAULT ''"); $pdo->exec("ALTER TABLE comments ADD COLUMN reference VARCHAR(50) DEFAULT ''"); @@ -769,17 +764,17 @@ function version_28($pdo) $pdo->exec('CREATE INDEX comments_reference_idx ON comments(reference)'); } -function version_27($pdo) +function version_27(PDO $pdo) { $pdo->exec('CREATE UNIQUE INDEX users_username_idx ON users(username)'); } -function version_26($pdo) +function version_26(PDO $pdo) { $pdo->exec("ALTER TABLE config ADD COLUMN default_columns VARCHAR(255) DEFAULT ''"); } -function version_25($pdo) +function version_25(PDO $pdo) { $pdo->exec(" CREATE TABLE task_has_events ( @@ -834,12 +829,12 @@ function version_25($pdo) "); } -function version_24($pdo) +function version_24(PDO $pdo) { $pdo->exec("ALTER TABLE projects ADD COLUMN is_public TINYINT(1) DEFAULT '0'"); } -function version_23($pdo) +function version_23(PDO $pdo) { $pdo->exec("ALTER TABLE users ADD COLUMN notifications_enabled TINYINT(1) DEFAULT '0'"); @@ -854,30 +849,30 @@ function version_23($pdo) "); } -function version_22($pdo) +function version_22(PDO $pdo) { $pdo->exec("ALTER TABLE config ADD COLUMN webhooks_url_task_modification VARCHAR(255)"); $pdo->exec("ALTER TABLE config ADD COLUMN webhooks_url_task_creation VARCHAR(255)"); } -function version_21($pdo) +function version_21(PDO $pdo) { $pdo->exec("ALTER TABLE tasks ADD COLUMN creator_id INTEGER DEFAULT '0'"); $pdo->exec("ALTER TABLE tasks ADD COLUMN date_modification INTEGER DEFAULT '0'"); } -function version_20($pdo) +function version_20(PDO $pdo) { $pdo->exec("ALTER TABLE users ADD COLUMN github_id VARCHAR(30)"); } -function version_19($pdo) +function version_19(PDO $pdo) { $pdo->exec("ALTER TABLE config ADD COLUMN api_token VARCHAR(255) DEFAULT ''"); $pdo->exec("UPDATE config SET api_token='".Security::generateToken()."'"); } -function version_18($pdo) +function version_18(PDO $pdo) { $pdo->exec(" CREATE TABLE task_has_subtasks ( @@ -894,7 +889,7 @@ function version_18($pdo) ); } -function version_17($pdo) +function version_17(PDO $pdo) { $pdo->exec(" CREATE TABLE task_has_files ( @@ -909,7 +904,7 @@ function version_17($pdo) ); } -function version_16($pdo) +function version_16(PDO $pdo) { $pdo->exec(" CREATE TABLE project_has_categories ( @@ -925,24 +920,24 @@ function version_16($pdo) $pdo->exec("ALTER TABLE tasks ADD COLUMN category_id INT DEFAULT 0"); } -function version_15($pdo) +function version_15(PDO $pdo) { $pdo->exec("ALTER TABLE projects ADD COLUMN last_modified INT DEFAULT 0"); } -function version_14($pdo) +function version_14(PDO $pdo) { $pdo->exec("ALTER TABLE users ADD COLUMN name VARCHAR(255)"); $pdo->exec("ALTER TABLE users ADD COLUMN email VARCHAR(255)"); $pdo->exec("ALTER TABLE users ADD COLUMN google_id VARCHAR(30)"); } -function version_13($pdo) +function version_13(PDO $pdo) { $pdo->exec("ALTER TABLE users ADD COLUMN is_ldap_user TINYINT(1) DEFAULT 0"); } -function version_12($pdo) +function version_12(PDO $pdo) { $pdo->exec(" CREATE TABLE remember_me ( @@ -974,7 +969,7 @@ function version_12($pdo) ); } -function version_1($pdo) +function version_1(PDO $pdo) { $pdo->exec(" CREATE TABLE config ( diff --git a/app/Schema/Postgres.php b/app/Schema/Postgres.php index 9e12a5e8..a3fb6d49 100644 --- a/app/Schema/Postgres.php +++ b/app/Schema/Postgres.php @@ -4,11 +4,10 @@ namespace Schema; use PDO; use Kanboard\Core\Security; -use Kanboard\Model\Link; const VERSION = 73; -function version_73($pdo) +function version_73(PDO $pdo) { $pdo->exec(" CREATE TABLE user_has_metadata ( @@ -58,7 +57,7 @@ function version_73($pdo) $pdo->exec("DELETE FROM settings WHERE \"option\"='integration_slack_webhook_channel'"); } -function version_72($pdo) +function version_72(PDO $pdo) { $pdo->exec(" CREATE TABLE project_has_notification_types ( @@ -71,12 +70,12 @@ function version_72($pdo) "); } -function version_71($pdo) +function version_71(PDO $pdo) { $pdo->exec("ALTER TABLE custom_filters ADD COLUMN \"append\" BOOLEAN DEFAULT '0'"); } -function version_70($pdo) +function version_70(PDO $pdo) { $pdo->exec("ALTER TABLE tasks ALTER COLUMN date_due TYPE BIGINT"); $pdo->exec("ALTER TABLE tasks ALTER COLUMN date_creation TYPE BIGINT"); @@ -95,7 +94,7 @@ function version_70($pdo) $pdo->exec('ALTER TABLE users ALTER COLUMN "lock_expiration_date" TYPE BIGINT'); } -function version_69($pdo) +function version_69(PDO $pdo) { $pdo->exec(" CREATE TABLE user_has_unread_notifications ( @@ -130,7 +129,7 @@ function version_69($pdo) } } -function version_68($pdo) +function version_68(PDO $pdo) { $pdo->exec(" CREATE TABLE custom_filters ( @@ -144,7 +143,7 @@ function version_68($pdo) "); } -function version_67($pdo) +function version_67(PDO $pdo) { $pdo->exec(" CREATE TABLE plugin_schema_versions ( @@ -154,45 +153,45 @@ function version_67($pdo) "); } -function version_66($pdo) +function version_66(PDO $pdo) { $pdo->exec("ALTER TABLE swimlanes ADD COLUMN description TEXT"); } -function version_65($pdo) +function version_65(PDO $pdo) { $pdo->exec("ALTER TABLE users ADD COLUMN gitlab_id INTEGER"); } -function version_64($pdo) +function version_64(PDO $pdo) { $pdo->exec("ALTER TABLE projects ADD COLUMN start_date VARCHAR(10) DEFAULT ''"); $pdo->exec("ALTER TABLE projects ADD COLUMN end_date VARCHAR(10) DEFAULT ''"); } -function version_63($pdo) +function version_63(PDO $pdo) { $pdo->exec("ALTER TABLE users ADD COLUMN is_project_admin BOOLEAN DEFAULT '0'"); } -function version_62($pdo) +function version_62(PDO $pdo) { $pdo->exec("ALTER TABLE users ADD COLUMN nb_failed_login INTEGER DEFAULT 0"); $pdo->exec("ALTER TABLE users ADD COLUMN lock_expiration_date INTEGER DEFAULT 0"); } -function version_61($pdo) +function version_61(PDO $pdo) { $pdo->exec("INSERT INTO settings VALUES ('subtask_time_tracking', '1')"); $pdo->exec("INSERT INTO settings VALUES ('cfd_include_closed_tasks', '1')"); } -function version_60($pdo) +function version_60(PDO $pdo) { $pdo->exec("INSERT INTO settings VALUES ('default_color', 'yellow')"); } -function version_59($pdo) +function version_59(PDO $pdo) { $pdo->exec(" CREATE TABLE project_daily_stats ( @@ -210,23 +209,23 @@ function version_59($pdo) $pdo->exec('ALTER TABLE project_daily_summaries RENAME TO project_daily_column_stats'); } -function version_58($pdo) +function version_58(PDO $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) +function version_57(PDO $pdo) { $pdo->exec('ALTER TABLE users DROP COLUMN "default_project_id"'); } -function version_56($pdo) +function version_56(PDO $pdo) { $pdo->exec('DELETE FROM "settings" WHERE "option"=\'subtask_time_tracking\''); } -function version_55($pdo) +function version_55(PDO $pdo) { $pdo->exec('ALTER TABLE comments DROP CONSTRAINT IF EXISTS comments_user_id_fkey'); $pdo->exec("ALTER TABLE comments ALTER COLUMN task_id SET NOT NULL"); @@ -235,7 +234,7 @@ function version_55($pdo) $pdo->exec("ALTER TABLE comments ALTER COLUMN date_creation SET NOT NULL"); } -function version_54($pdo) +function version_54(PDO $pdo) { $pdo->exec("ALTER TABLE project_has_categories ALTER COLUMN project_id SET NOT NULL"); $pdo->exec("ALTER TABLE project_has_categories ALTER COLUMN name SET NOT NULL"); @@ -271,12 +270,12 @@ function version_54($pdo) $pdo->exec("ALTER TABLE user_has_notifications ALTER COLUMN user_id SET NOT NULL"); } -function version_53($pdo) +function version_53(PDO $pdo) { $pdo->exec("ALTER TABLE users ADD COLUMN notifications_filter INTEGER DEFAULT 4"); } -function version_52($pdo) +function version_52(PDO $pdo) { $rq = $pdo->prepare('INSERT INTO settings VALUES (?, ?)'); $rq->execute(array('webhook_url', '')); @@ -285,17 +284,13 @@ function version_52($pdo) $pdo->exec("DELETE FROM settings WHERE option='webhook_url_task_modification'"); } -function version_51($pdo) +function version_51(PDO $pdo) { $pdo->exec("ALTER TABLE users ADD COLUMN token VARCHAR(255) DEFAULT ''"); } -function version_50($pdo) +function version_50(PDO $pdo) { - $rq = $pdo->prepare("SELECT value FROM settings WHERE option='subtask_forecast'"); - $rq->execute(); - $result = $rq->fetch(PDO::FETCH_ASSOC); - $rq = $pdo->prepare('INSERT INTO settings VALUES (?, ?)'); $rq->execute(array('calendar_user_subtasks_time_tracking', 0)); $rq->execute(array('calendar_user_tasks', 'date_started')); @@ -304,7 +299,7 @@ function version_50($pdo) $pdo->exec("DELETE FROM settings WHERE option='subtask_forecast'"); } -function version_49($pdo) +function version_49(PDO $pdo) { $rq = $pdo->prepare('INSERT INTO settings VALUES (?, ?)'); $rq->execute(array('integration_jabber', '0')); @@ -324,7 +319,7 @@ function version_49($pdo) $pdo->exec("ALTER TABLE project_integrations ADD COLUMN jabber_room VARCHAR(255) DEFAULT ''"); } -function version_48($pdo) +function version_48(PDO $pdo) { $pdo->exec('ALTER TABLE tasks ADD COLUMN recurrence_status INTEGER NOT NULL DEFAULT 0'); $pdo->exec('ALTER TABLE tasks ADD COLUMN recurrence_trigger INTEGER NOT NULL DEFAULT 0'); @@ -335,12 +330,12 @@ function version_48($pdo) $pdo->exec('ALTER TABLE tasks ADD COLUMN recurrence_child INTEGER'); } -function version_47($pdo) +function version_47(PDO $pdo) { $pdo->exec("ALTER TABLE projects ADD COLUMN identifier VARCHAR(50) DEFAULT ''"); } -function version_46($pdo) +function version_46(PDO $pdo) { $pdo->exec(" CREATE TABLE project_integrations ( @@ -357,36 +352,36 @@ function version_46($pdo) "); } -function version_45($pdo) +function version_45(PDO $pdo) { $pdo->exec('ALTER TABLE project_daily_summaries ADD COLUMN score INTEGER NOT NULL DEFAULT 0'); } -function version_44($pdo) +function version_44(PDO $pdo) { $pdo->exec('ALTER TABLE project_has_categories ADD COLUMN description TEXT'); } -function version_43($pdo) +function version_43(PDO $pdo) { $pdo->exec('ALTER TABLE files ADD COLUMN "date" INTEGER NOT NULL DEFAULT 0'); $pdo->exec('ALTER TABLE files ADD COLUMN "user_id" INTEGER NOT NULL DEFAULT 0'); $pdo->exec('ALTER TABLE files ADD COLUMN "size" INTEGER NOT NULL DEFAULT 0'); } -function version_42($pdo) +function version_42(PDO $pdo) { $pdo->exec('ALTER TABLE users ADD COLUMN twofactor_activated BOOLEAN DEFAULT \'0\''); $pdo->exec('ALTER TABLE users ADD COLUMN twofactor_secret CHAR(16)'); } -function version_41($pdo) +function version_41(PDO $pdo) { $rq = $pdo->prepare('INSERT INTO settings VALUES (?, ?)'); $rq->execute(array('integration_gravatar', '0')); } -function version_40($pdo) +function version_40(PDO $pdo) { $rq = $pdo->prepare('INSERT INTO settings VALUES (?, ?)'); $rq->execute(array('integration_hipchat', '0')); @@ -395,14 +390,14 @@ function version_40($pdo) $rq->execute(array('integration_hipchat_room_token', '')); } -function version_39($pdo) +function version_39(PDO $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) +function version_38(PDO $pdo) { $pdo->exec('CREATE TABLE currencies ("currency" CHAR(3) NOT NULL UNIQUE, "rate" REAL DEFAULT 0)'); @@ -410,7 +405,7 @@ function version_38($pdo) $rq->execute(array('application_currency', 'USD')); } -function version_37($pdo) +function version_37(PDO $pdo) { $pdo->exec('CREATE TABLE transitions ( "id" SERIAL PRIMARY KEY, @@ -433,24 +428,24 @@ function version_37($pdo) $pdo->exec("CREATE INDEX transitions_user_index ON transitions(user_id)"); } -function version_36($pdo) +function version_36(PDO $pdo) { $rq = $pdo->prepare('INSERT INTO settings VALUES (?, ?)'); $rq->execute(array('subtask_forecast', '0')); } -function version_35($pdo) +function version_35(PDO $pdo) { $rq = $pdo->prepare('INSERT INTO settings VALUES (?, ?)'); $rq->execute(array('application_stylesheet', '')); } -function version_34($pdo) +function version_34(PDO $pdo) { $pdo->exec("ALTER TABLE subtask_time_tracking ADD COLUMN time_spent REAL DEFAULT 0"); } -function version_30($pdo) +function version_30(PDO $pdo) { $pdo->exec('ALTER TABLE subtasks ADD COLUMN position INTEGER DEFAULT 1'); @@ -472,18 +467,18 @@ function version_30($pdo) } } -function version_29($pdo) +function version_29(PDO $pdo) { $pdo->exec('ALTER TABLE task_has_files RENAME TO files'); $pdo->exec('ALTER TABLE task_has_subtasks RENAME TO subtasks'); } -function version_28($pdo) +function version_28(PDO $pdo) { $pdo->exec('ALTER TABLE projects ADD COLUMN description TEXT'); } -function version_27($pdo) +function version_27(PDO $pdo) { $pdo->exec('CREATE TABLE links ( "id" SERIAL PRIMARY KEY, @@ -519,7 +514,7 @@ function version_27($pdo) $rq->execute(array('is fixed by', 10)); } -function version_26($pdo) +function version_26(PDO $pdo) { $pdo->exec('ALTER TABLE tasks ADD COLUMN date_moved INT DEFAULT 0'); @@ -552,12 +547,12 @@ function version_26($pdo) $pdo->exec("UPDATE tasks SET date_moved = date_creation WHERE date_moved IS NULL OR date_moved = 0"); } -function version_25($pdo) +function version_25(PDO $pdo) { $pdo->exec("ALTER TABLE users ADD COLUMN disable_login_form BOOLEAN DEFAULT '0'"); } -function version_24($pdo) +function version_24(PDO $pdo) { $rq = $pdo->prepare('INSERT INTO settings VALUES (?, ?)'); $rq->execute(array('subtask_restriction', '0')); @@ -576,18 +571,18 @@ function version_24($pdo) '); } -function version_23($pdo) +function version_23(PDO $pdo) { $pdo->exec('ALTER TABLE columns ADD COLUMN description TEXT'); } -function version_22($pdo) +function version_22(PDO $pdo) { $pdo->exec('ALTER TABLE users ADD COLUMN timezone VARCHAR(50)'); $pdo->exec('ALTER TABLE users ADD COLUMN language CHAR(5)'); } -function version_21($pdo) +function version_21(PDO $pdo) { // Avoid some full table scans $pdo->exec('CREATE INDEX users_admin_idx ON users(is_admin)'); @@ -611,13 +606,13 @@ function version_21($pdo) } } -function version_20($pdo) +function version_20(PDO $pdo) { $rq = $pdo->prepare('INSERT INTO settings VALUES (?, ?)'); $rq->execute(array('project_categories', '')); } -function version_19($pdo) +function version_19(PDO $pdo) { $pdo->exec(" CREATE TABLE swimlanes ( @@ -636,17 +631,17 @@ function version_19($pdo) $pdo->exec("ALTER TABLE projects ADD COLUMN show_default_swimlane BOOLEAN DEFAULT '1'"); } -function version_18($pdo) +function version_18(PDO $pdo) { $pdo->exec("ALTER TABLE project_has_users ADD COLUMN is_owner BOOLEAN DEFAULT '0'"); } -function version_17($pdo) +function version_17(PDO $pdo) { $pdo->exec('ALTER TABLE tasks ALTER COLUMN title SET NOT NULL'); } -function version_16($pdo) +function version_16(PDO $pdo) { $pdo->exec(" CREATE TABLE project_daily_summaries ( @@ -663,12 +658,12 @@ function version_16($pdo) $pdo->exec('CREATE UNIQUE INDEX project_daily_column_stats_idx ON project_daily_summaries(day, project_id, column_id)'); } -function version_15($pdo) +function version_15(PDO $pdo) { $pdo->exec("ALTER TABLE projects ADD COLUMN is_everybody_allowed BOOLEAN DEFAULT '0'"); } -function version_14($pdo) +function version_14(PDO $pdo) { $pdo->exec(" CREATE TABLE project_activities ( @@ -690,7 +685,7 @@ function version_14($pdo) $pdo->exec('DROP TABLE subtask_has_events'); } -function version_13($pdo) +function version_13(PDO $pdo) { $pdo->exec("ALTER TABLE tasks ADD COLUMN date_started INTEGER"); $pdo->exec("ALTER TABLE tasks ADD COLUMN time_spent FLOAT DEFAULT 0"); @@ -700,18 +695,18 @@ function version_13($pdo) $pdo->exec("ALTER TABLE task_has_subtasks ALTER COLUMN time_spent TYPE FLOAT"); } -function version_12($pdo) +function version_12(PDO $pdo) { $pdo->exec("ALTER TABLE projects ADD COLUMN is_private BOOLEAN DEFAULT '0'"); } -function version_11($pdo) +function version_11(PDO $pdo) { $rq = $pdo->prepare('INSERT INTO settings VALUES (?, ?)'); $rq->execute(array('application_date_format', 'm/d/Y')); } -function version_10($pdo) +function version_10(PDO $pdo) { $pdo->exec(" CREATE TABLE settings ( @@ -741,7 +736,7 @@ function version_10($pdo) $pdo->exec('DROP TABLE config'); } -function version_9($pdo) +function version_9(PDO $pdo) { $pdo->exec("ALTER TABLE tasks ADD COLUMN reference VARCHAR(50) DEFAULT ''"); $pdo->exec("ALTER TABLE comments ADD COLUMN reference VARCHAR(50) DEFAULT ''"); @@ -750,17 +745,17 @@ function version_9($pdo) $pdo->exec('CREATE INDEX comments_reference_idx ON comments(reference)'); } -function version_8($pdo) +function version_8(PDO $pdo) { $pdo->exec('CREATE UNIQUE INDEX users_username_idx ON users(username)'); } -function version_7($pdo) +function version_7(PDO $pdo) { $pdo->exec("ALTER TABLE config ADD COLUMN default_columns VARCHAR(255) DEFAULT ''"); } -function version_6($pdo) +function version_6(PDO $pdo) { $pdo->exec(" CREATE TABLE task_has_events ( @@ -812,12 +807,12 @@ function version_6($pdo) "); } -function version_5($pdo) +function version_5(PDO $pdo) { $pdo->exec("ALTER TABLE projects ADD COLUMN is_public BOOLEAN DEFAULT '0'"); } -function version_4($pdo) +function version_4(PDO $pdo) { $pdo->exec("ALTER TABLE users ADD COLUMN notifications_enabled BOOLEAN DEFAULT '0'"); @@ -832,19 +827,19 @@ function version_4($pdo) "); } -function version_3($pdo) +function version_3(PDO $pdo) { $pdo->exec("ALTER TABLE config ADD COLUMN webhooks_url_task_modification VARCHAR(255)"); $pdo->exec("ALTER TABLE config ADD COLUMN webhooks_url_task_creation VARCHAR(255)"); } -function version_2($pdo) +function version_2(PDO $pdo) { $pdo->exec("ALTER TABLE tasks ADD COLUMN creator_id INTEGER DEFAULT 0"); $pdo->exec("ALTER TABLE tasks ADD COLUMN date_modification INTEGER DEFAULT 0"); } -function version_1($pdo) +function version_1(PDO $pdo) { $pdo->exec(" CREATE TABLE config ( diff --git a/app/Schema/Sqlite.php b/app/Schema/Sqlite.php index e8dcf50e..b9ab86f8 100644 --- a/app/Schema/Sqlite.php +++ b/app/Schema/Sqlite.php @@ -4,11 +4,10 @@ namespace Schema; use Kanboard\Core\Security; use PDO; -use Kanboard\Model\Link; const VERSION = 88; -function version_88($pdo) +function version_88(PDO $pdo) { $pdo->exec(" CREATE TABLE user_has_metadata ( @@ -58,7 +57,7 @@ function version_88($pdo) $pdo->exec("DELETE FROM settings WHERE \"option\"='integration_slack_webhook_channel'"); } -function version_87($pdo) +function version_87(PDO $pdo) { $pdo->exec(" CREATE TABLE project_has_notification_types ( @@ -71,12 +70,12 @@ function version_87($pdo) "); } -function version_86($pdo) +function version_86(PDO $pdo) { $pdo->exec("ALTER TABLE custom_filters ADD COLUMN append INTEGER DEFAULT 0"); } -function version_85($pdo) +function version_85(PDO $pdo) { $pdo->exec(" CREATE TABLE user_has_unread_notifications ( @@ -111,7 +110,7 @@ function version_85($pdo) } } -function version_84($pdo) +function version_84(PDO $pdo) { $pdo->exec(" CREATE TABLE custom_filters ( @@ -125,7 +124,7 @@ function version_84($pdo) "); } -function version_83($pdo) +function version_83(PDO $pdo) { $pdo->exec(" CREATE TABLE plugin_schema_versions ( @@ -135,45 +134,45 @@ function version_83($pdo) "); } -function version_82($pdo) +function version_82(PDO $pdo) { $pdo->exec("ALTER TABLE swimlanes ADD COLUMN description TEXT"); } -function version_81($pdo) +function version_81(PDO $pdo) { $pdo->exec("ALTER TABLE users ADD COLUMN gitlab_id INTEGER"); } -function version_80($pdo) +function version_80(PDO $pdo) { $pdo->exec("ALTER TABLE projects ADD COLUMN start_date TEXT DEFAULT ''"); $pdo->exec("ALTER TABLE projects ADD COLUMN end_date TEXT DEFAULT ''"); } -function version_79($pdo) +function version_79(PDO $pdo) { $pdo->exec("ALTER TABLE users ADD COLUMN is_project_admin INTEGER DEFAULT 0"); } -function version_78($pdo) +function version_78(PDO $pdo) { $pdo->exec("ALTER TABLE users ADD COLUMN nb_failed_login INTEGER DEFAULT 0"); $pdo->exec("ALTER TABLE users ADD COLUMN lock_expiration_date INTEGER DEFAULT 0"); } -function version_77($pdo) +function version_77(PDO $pdo) { $pdo->exec("INSERT INTO settings VALUES ('subtask_time_tracking', '1')"); $pdo->exec("INSERT INTO settings VALUES ('cfd_include_closed_tasks', '1')"); } -function version_76($pdo) +function version_76(PDO $pdo) { $pdo->exec("INSERT INTO settings VALUES ('default_color', 'yellow')"); } -function version_75($pdo) +function version_75(PDO $pdo) { $pdo->exec(" CREATE TABLE project_daily_stats ( @@ -191,18 +190,18 @@ function version_75($pdo) $pdo->exec('ALTER TABLE project_daily_summaries RENAME TO project_daily_column_stats'); } -function version_74($pdo) +function version_74(PDO $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) +function version_73(PDO $pdo) { $pdo->exec("DELETE FROM settings WHERE option='subtask_time_tracking'"); } -function version_72($pdo) +function version_72(PDO $pdo) { $pdo->exec( 'ALTER TABLE comments RENAME TO comments_bak' @@ -229,12 +228,12 @@ function version_72($pdo) ); } -function version_71($pdo) +function version_71(PDO $pdo) { $pdo->exec("ALTER TABLE users ADD COLUMN notifications_filter INTEGER DEFAULT 4"); } -function version_70($pdo) +function version_70(PDO $pdo) { $rq = $pdo->prepare('INSERT INTO settings VALUES (?, ?)'); $rq->execute(array('webhook_url', '')); @@ -243,17 +242,13 @@ function version_70($pdo) $pdo->exec("DELETE FROM settings WHERE option='webhook_url_task_modification'"); } -function version_69($pdo) +function version_69(PDO $pdo) { $pdo->exec("ALTER TABLE users ADD COLUMN token TEXT DEFAULT ''"); } -function version_68($pdo) +function version_68(PDO $pdo) { - $rq = $pdo->prepare("SELECT value FROM settings WHERE option='subtask_forecast'"); - $rq->execute(); - $result = $rq->fetch(PDO::FETCH_ASSOC); - $rq = $pdo->prepare('INSERT INTO settings VALUES (?, ?)'); $rq->execute(array('calendar_user_subtasks_time_tracking', 0)); $rq->execute(array('calendar_user_tasks', 'date_started')); @@ -262,7 +257,7 @@ function version_68($pdo) $pdo->exec("DELETE FROM settings WHERE option='subtask_forecast'"); } -function version_67($pdo) +function version_67(PDO $pdo) { $rq = $pdo->prepare('INSERT INTO settings VALUES (?, ?)'); $rq->execute(array('integration_jabber', '0')); @@ -282,7 +277,7 @@ function version_67($pdo) $pdo->exec("ALTER TABLE project_integrations ADD COLUMN jabber_room TEXT DEFAULT ''"); } -function version_66($pdo) +function version_66(PDO $pdo) { $pdo->exec('ALTER TABLE tasks ADD COLUMN recurrence_status INTEGER NOT NULL DEFAULT 0'); $pdo->exec('ALTER TABLE tasks ADD COLUMN recurrence_trigger INTEGER NOT NULL DEFAULT 0'); @@ -293,12 +288,12 @@ function version_66($pdo) $pdo->exec('ALTER TABLE tasks ADD COLUMN recurrence_child INTEGER'); } -function version_65($pdo) +function version_65(PDO $pdo) { $pdo->exec("ALTER TABLE projects ADD COLUMN identifier TEXT DEFAULT ''"); } -function version_64($pdo) +function version_64(PDO $pdo) { $pdo->exec(" CREATE TABLE project_integrations ( @@ -315,36 +310,36 @@ function version_64($pdo) "); } -function version_63($pdo) +function version_63(PDO $pdo) { $pdo->exec('ALTER TABLE project_daily_summaries ADD COLUMN score INTEGER NOT NULL DEFAULT 0'); } -function version_62($pdo) +function version_62(PDO $pdo) { $pdo->exec('ALTER TABLE project_has_categories ADD COLUMN description TEXT'); } -function version_61($pdo) +function version_61(PDO $pdo) { $pdo->exec('ALTER TABLE files ADD COLUMN "date" INTEGER NOT NULL DEFAULT 0'); $pdo->exec('ALTER TABLE files ADD COLUMN "user_id" INTEGER NOT NULL DEFAULT 0'); $pdo->exec('ALTER TABLE files ADD COLUMN "size" INTEGER NOT NULL DEFAULT 0'); } -function version_60($pdo) +function version_60(PDO $pdo) { $pdo->exec('ALTER TABLE users ADD COLUMN twofactor_activated INTEGER DEFAULT 0'); $pdo->exec('ALTER TABLE users ADD COLUMN twofactor_secret TEXT'); } -function version_59($pdo) +function version_59(PDO $pdo) { $rq = $pdo->prepare('INSERT INTO settings VALUES (?, ?)'); $rq->execute(array('integration_gravatar', '0')); } -function version_58($pdo) +function version_58(PDO $pdo) { $rq = $pdo->prepare('INSERT INTO settings VALUES (?, ?)'); $rq->execute(array('integration_hipchat', '0')); @@ -353,14 +348,14 @@ function version_58($pdo) $rq->execute(array('integration_hipchat_room_token', '')); } -function version_57($pdo) +function version_57(PDO $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) +function version_56(PDO $pdo) { $pdo->exec('CREATE TABLE currencies ("currency" TEXT NOT NULL UNIQUE, "rate" REAL DEFAULT 0)'); @@ -368,7 +363,7 @@ function version_56($pdo) $rq->execute(array('application_currency', 'USD')); } -function version_55($pdo) +function version_55(PDO $pdo) { $pdo->exec('CREATE TABLE transitions ( "id" INTEGER PRIMARY KEY, @@ -391,24 +386,24 @@ function version_55($pdo) $pdo->exec("CREATE INDEX transitions_user_index ON transitions(user_id)"); } -function version_54($pdo) +function version_54(PDO $pdo) { $rq = $pdo->prepare('INSERT INTO settings VALUES (?, ?)'); $rq->execute(array('subtask_forecast', '0')); } -function version_53($pdo) +function version_53(PDO $pdo) { $rq = $pdo->prepare('INSERT INTO settings VALUES (?, ?)'); $rq->execute(array('application_stylesheet', '')); } -function version_52($pdo) +function version_52(PDO $pdo) { $pdo->exec("ALTER TABLE subtask_time_tracking ADD COLUMN time_spent REAL DEFAULT 0"); } -function version_48($pdo) +function version_48(PDO $pdo) { $pdo->exec('ALTER TABLE subtasks ADD COLUMN position INTEGER DEFAULT 1'); @@ -432,18 +427,18 @@ function version_48($pdo) } } -function version_47($pdo) +function version_47(PDO $pdo) { $pdo->exec('ALTER TABLE task_has_files RENAME TO files'); $pdo->exec('ALTER TABLE task_has_subtasks RENAME TO subtasks'); } -function version_46($pdo) +function version_46(PDO $pdo) { $pdo->exec('ALTER TABLE projects ADD COLUMN description TEXT'); } -function version_45($pdo) +function version_45(PDO $pdo) { $pdo->exec("CREATE TABLE links ( id INTEGER PRIMARY KEY, @@ -479,7 +474,7 @@ function version_45($pdo) $rq->execute(array('is fixed by', 10)); } -function version_44($pdo) +function version_44(PDO $pdo) { $pdo->exec('ALTER TABLE tasks ADD COLUMN date_moved INTEGER DEFAULT 0'); @@ -512,12 +507,12 @@ function version_44($pdo) $pdo->exec("UPDATE tasks SET date_moved = date_creation WHERE date_moved IS NULL OR date_moved = 0"); } -function version_43($pdo) +function version_43(PDO $pdo) { $pdo->exec('ALTER TABLE users ADD COLUMN disable_login_form INTEGER DEFAULT 0'); } -function version_42($pdo) +function version_42(PDO $pdo) { $rq = $pdo->prepare('INSERT INTO settings VALUES (?, ?)'); $rq->execute(array('subtask_restriction', '0')); @@ -536,18 +531,18 @@ function version_42($pdo) "); } -function version_41($pdo) +function version_41(PDO $pdo) { $pdo->exec('ALTER TABLE columns ADD COLUMN description TEXT'); } -function version_40($pdo) +function version_40(PDO $pdo) { $pdo->exec('ALTER TABLE users ADD COLUMN timezone TEXT'); $pdo->exec('ALTER TABLE users ADD COLUMN language TEXT'); } -function version_39($pdo) +function version_39(PDO $pdo) { // Avoid some full table scans $pdo->exec('CREATE INDEX users_admin_idx ON users(is_admin)'); @@ -571,13 +566,13 @@ function version_39($pdo) } } -function version_38($pdo) +function version_38(PDO $pdo) { $rq = $pdo->prepare('INSERT INTO settings VALUES (?, ?)'); $rq->execute(array('project_categories', '')); } -function version_37($pdo) +function version_37(PDO $pdo) { $pdo->exec(" CREATE TABLE swimlanes ( @@ -596,12 +591,12 @@ function version_37($pdo) $pdo->exec("ALTER TABLE projects ADD COLUMN show_default_swimlane INTEGER DEFAULT 1"); } -function version_36($pdo) +function version_36(PDO $pdo) { $pdo->exec('ALTER TABLE project_has_users ADD COLUMN is_owner INTEGER DEFAULT "0"'); } -function version_35($pdo) +function version_35(PDO $pdo) { $pdo->exec(" CREATE TABLE project_daily_summaries ( @@ -618,12 +613,12 @@ function version_35($pdo) $pdo->exec('CREATE UNIQUE INDEX project_daily_column_stats_idx ON project_daily_summaries(day, project_id, column_id)'); } -function version_34($pdo) +function version_34(PDO $pdo) { $pdo->exec('ALTER TABLE projects ADD COLUMN is_everybody_allowed INTEGER DEFAULT "0"'); } -function version_33($pdo) +function version_33(PDO $pdo) { $pdo->exec(" CREATE TABLE project_activities ( @@ -645,25 +640,25 @@ function version_33($pdo) $pdo->exec('DROP TABLE subtask_has_events'); } -function version_32($pdo) +function version_32(PDO $pdo) { $pdo->exec("ALTER TABLE tasks ADD COLUMN date_started INTEGER"); $pdo->exec("ALTER TABLE tasks ADD COLUMN time_spent NUMERIC DEFAULT 0"); $pdo->exec("ALTER TABLE tasks ADD COLUMN time_estimated NUMERIC DEFAULT 0"); } -function version_31($pdo) +function version_31(PDO $pdo) { $pdo->exec('ALTER TABLE projects ADD COLUMN is_private INTEGER DEFAULT "0"'); } -function version_30($pdo) +function version_30(PDO $pdo) { $rq = $pdo->prepare('INSERT INTO settings VALUES (?, ?)'); $rq->execute(array('application_date_format', 'm/d/Y')); } -function version_29($pdo) +function version_29(PDO $pdo) { $pdo->exec(" CREATE TABLE settings ( @@ -693,7 +688,7 @@ function version_29($pdo) $pdo->exec('DROP TABLE config'); } -function version_28($pdo) +function version_28(PDO $pdo) { $pdo->exec("ALTER TABLE tasks ADD COLUMN reference TEXT DEFAULT ''"); $pdo->exec("ALTER TABLE comments ADD COLUMN reference TEXT DEFAULT ''"); @@ -702,17 +697,17 @@ function version_28($pdo) $pdo->exec('CREATE INDEX comments_reference_idx ON comments(reference)'); } -function version_27($pdo) +function version_27(PDO $pdo) { $pdo->exec('CREATE UNIQUE INDEX users_username_idx ON users(username)'); } -function version_26($pdo) +function version_26(PDO $pdo) { $pdo->exec("ALTER TABLE config ADD COLUMN default_columns TEXT DEFAULT ''"); } -function version_25($pdo) +function version_25(PDO $pdo) { $pdo->exec(" CREATE TABLE task_has_events ( @@ -764,12 +759,12 @@ function version_25($pdo) "); } -function version_24($pdo) +function version_24(PDO $pdo) { $pdo->exec('ALTER TABLE projects ADD COLUMN is_public INTEGER DEFAULT "0"'); } -function version_23($pdo) +function version_23(PDO $pdo) { $pdo->exec("ALTER TABLE users ADD COLUMN notifications_enabled INTEGER DEFAULT '0'"); @@ -784,30 +779,30 @@ function version_23($pdo) "); } -function version_22($pdo) +function version_22(PDO $pdo) { $pdo->exec("ALTER TABLE config ADD COLUMN webhooks_url_task_modification TEXT"); $pdo->exec("ALTER TABLE config ADD COLUMN webhooks_url_task_creation TEXT"); } -function version_21($pdo) +function version_21(PDO $pdo) { $pdo->exec("ALTER TABLE tasks ADD COLUMN creator_id INTEGER DEFAULT '0'"); $pdo->exec("ALTER TABLE tasks ADD COLUMN date_modification INTEGER DEFAULT '0'"); } -function version_20($pdo) +function version_20(PDO $pdo) { $pdo->exec("ALTER TABLE users ADD COLUMN github_id TEXT"); } -function version_19($pdo) +function version_19(PDO $pdo) { $pdo->exec("ALTER TABLE config ADD COLUMN api_token TEXT DEFAULT ''"); $pdo->exec("UPDATE config SET api_token='".Security::generateToken()."'"); } -function version_18($pdo) +function version_18(PDO $pdo) { $pdo->exec(" CREATE TABLE task_has_subtasks ( @@ -823,7 +818,7 @@ function version_18($pdo) ); } -function version_17($pdo) +function version_17(PDO $pdo) { $pdo->exec(" CREATE TABLE task_has_files ( @@ -837,7 +832,7 @@ function version_17($pdo) ); } -function version_16($pdo) +function version_16(PDO $pdo) { $pdo->exec(" CREATE TABLE project_has_categories ( @@ -852,24 +847,24 @@ function version_16($pdo) $pdo->exec("ALTER TABLE tasks ADD COLUMN category_id INTEGER DEFAULT 0"); } -function version_15($pdo) +function version_15(PDO $pdo) { $pdo->exec("ALTER TABLE projects ADD COLUMN last_modified INTEGER DEFAULT 0"); } -function version_14($pdo) +function version_14(PDO $pdo) { $pdo->exec("ALTER TABLE users ADD COLUMN name TEXT"); $pdo->exec("ALTER TABLE users ADD COLUMN email TEXT"); $pdo->exec("ALTER TABLE users ADD COLUMN google_id TEXT"); } -function version_13($pdo) +function version_13(PDO $pdo) { $pdo->exec("ALTER TABLE users ADD COLUMN is_ldap_user INTEGER DEFAULT 0"); } -function version_12($pdo) +function version_12(PDO $pdo) { $pdo->exec( 'CREATE TABLE remember_me ( @@ -900,7 +895,7 @@ function version_12($pdo) $pdo->exec('CREATE INDEX last_logins_user_idx ON last_logins(user_id)'); } -function version_11($pdo) +function version_11(PDO $pdo) { $pdo->exec( 'ALTER TABLE comments RENAME TO comments_bak' @@ -927,7 +922,7 @@ function version_11($pdo) ); } -function version_10($pdo) +function version_10(PDO $pdo) { $pdo->exec( 'CREATE TABLE actions ( @@ -950,12 +945,12 @@ function version_10($pdo) ); } -function version_9($pdo) +function version_9(PDO $pdo) { $pdo->exec("ALTER TABLE tasks ADD COLUMN date_due INTEGER"); } -function version_8($pdo) +function version_8(PDO $pdo) { $pdo->exec( 'CREATE TABLE comments ( @@ -970,7 +965,7 @@ function version_8($pdo) ); } -function version_7($pdo) +function version_7(PDO $pdo) { $pdo->exec(" CREATE TABLE project_has_users ( @@ -984,33 +979,33 @@ function version_7($pdo) "); } -function version_6($pdo) +function version_6(PDO $pdo) { $pdo->exec("ALTER TABLE columns ADD COLUMN task_limit INTEGER DEFAULT '0'"); } -function version_5($pdo) +function version_5(PDO $pdo) { $pdo->exec("ALTER TABLE tasks ADD COLUMN score INTEGER"); } -function version_4($pdo) +function version_4(PDO $pdo) { $pdo->exec("ALTER TABLE config ADD COLUMN timezone TEXT DEFAULT 'UTC'"); } -function version_3($pdo) +function version_3(PDO $pdo) { $pdo->exec('ALTER TABLE projects ADD COLUMN token TEXT'); } -function version_2($pdo) +function version_2(PDO $pdo) { $pdo->exec('ALTER TABLE tasks ADD COLUMN date_completed INTEGER'); $pdo->exec('UPDATE tasks SET date_completed=date_creation WHERE is_active=0'); } -function version_1($pdo) +function version_1(PDO $pdo) { $pdo->exec(" CREATE TABLE config ( |