diff options
Diffstat (limited to 'app/Schema/Sqlite.php')
-rw-r--r-- | app/Schema/Sqlite.php | 175 |
1 files changed, 85 insertions, 90 deletions
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 ( |