<?php include "../../extensions/global.php"; include "../patches.php"; $patchNumber = 7; start_patch(); if (!patch_exists($patchNumber)) { $addWebcamID = "alter table bots add column `webcam_image_id` int(11) unsigned NOT NULL DEFAULT '0'"; db()->execute($addWebcamID); finish_patch($patchNumber, "Adding webcam image to bot temporarily"); }
<?php include "../../extensions/global.php"; include "../patches.php"; $patchNumber = 11; start_patch(); if (!patch_exists($patchNumber)) { $addDroppedSQL = "ALTER TABLE job_clock\n \t\tMODIFY COLUMN status\n \t\tenum('working','waiting', 'complete', 'dropped')"; db()->execute($addDroppedSQL); finish_patch($patchNumber, "Changing job_clock enum"); }
$job = new Job($row['id']); $fixed_data = fix_temp_data($job->get('temperature_data')); $job->set('temperature_data', $fixed_data); $job->save(); } $rs = db()->query("SELECT * from bots"); while ($row = $rs->fetch(PDO::FETCH_ASSOC)) { $bot = new Bot($row['id']); $fixed_data = fix_temp_data($bot->get('temperature_data')); $bot->set('temperature_data', $fixed_data); $bot->save(); } $expandTemperatureData = "\n\t\tALTER TABLE jobs\n \t\tMODIFY COLUMN temperature_data longtext NOT NULL"; db()->execute($expandTemperatureData); $expandTemperatureData = "\n\t\tALTER TABLE bots\n \t\tMODIFY COLUMN temperature_data longtext NOT NULL"; finish_patch($patchNumber, "Expanded temperature data fields"); } function fix_temp_data($data) { if (strlen($data) == 0) { return ""; } $data .= "}"; while (JSON::decode($data) === null) { // Remove last two characters $data = substr($data, 0, -2); // Add the end of the temperature data $data .= "}"; } return $data; }
<?php include "../../extensions/global.php"; include "../patches.php"; $patchNumber = 5; start_patch(); if (!patch_exists($patchNumber)) { $addContentIDKey = "ALTER TABLE comments ADD KEY `content_id` (`content_id`)"; db()->execute($addContentIDKey); $addContentTypeKey = "ALTER TABLE comments ADD KEY `content_type` (`content_type`)"; db()->execute($addContentTypeKey); $addWebcamID = "alter table jobs add column `webcam_image_id` int(11) unsigned NOT NULL DEFAULT '0' after verified_time;"; db()->execute($addWebcamID); $addWebcamImages = "alter table jobs add column `webcam_images` text NOT NULL after webcam_image_id"; db()->execute($addWebcamImages); $dropTimestamp = "alter table oauth_consumer_nonce drop index timestamp"; db()->execute($dropTimestamp); $dropNonce = "alter table oauth_consumer_nonce drop index nonce"; db()->execute($dropNonce); $addIPAddressKey = "alter table oauth_token add KEY `ip_address` (`ip_address`)"; db()->execute($addIPAddressKey); $addParentIDKey = "alter table s3_files add KEY `parent_id` (`parent_id`)"; db()->execute($addParentIDKey); $modifyThingiverseToken = "alter table users modify `thingiverse_token` varchar(40) NOT NULL DEFAULT ''"; db()->execute($modifyThingiverseToken); $modifyThumbnail = "alter table users modify `dashboard_style` enum('list','large_thumbnails','medium_thumbnails','small_thumbnails') NOT NULL DEFAULT 'large_thumbnails'"; db()->execute($modifyThumbnail); finish_patch($patchNumber, "Updating the dev table to BotQueue production"); }
<?php include "../../extensions/global.php"; include "../patches.php"; $patchNumber = 8; start_patch(); if (!patch_exists($patchNumber)) { $removeSlicerDescription = "alter table slice_engines drop column engine_description"; db()->execute($removeSlicerDescription); finish_patch($patchNumber, "Removing the engine_description"); }
<?php include "../../extensions/global.php"; include "../patches.php"; $patchNumber = 1; start_patch(); // This patch is literally just the starting point for other patches // It's pretty much just an example if (!patch_exists($patchNumber)) { finish_patch($patchNumber, "Starting the patch system"); }
<?php include "../../extensions/global.php"; include "../patches.php"; $patchNumber = 6; start_patch(); if (!patch_exists($patchNumber)) { $createTable = "CREATE TABLE `engine_os` (\n\t\t`engine_id` INT(11) UNSIGNED NOT NULL,\n\t\t`os` ENUM('osx','linux','win','raspberrypi'),\n\t\tPRIMARY KEY (`engine_id`, `os`)\n\t\t) ENGINE=MyISAM DEFAULT CHARSET=utf8"; db()->execute($createTable); finish_patch($patchNumber, "Creating Engine OS table"); }
<?php include "../../extensions/global.php"; include "../patches.php"; $patchNumber = 10; start_patch(); if (!patch_exists($patchNumber)) { $statsViewSQL = "\n CREATE VIEW stats AS\n SELECT (unix_timestamp(end_date) - unix_timestamp(start_date)) AS seconds,\n bot_id, user_id, status, start_date, end_date\n FROM job_clock\n WHERE status != 'working'\n ORDER by seconds DESC\n "; db()->execute($statsViewSQL); finish_patch($patchNumber, "Adding stats view"); }
<?php include "../../extensions/global.php"; include "../patches.php"; $patchNumber = 3; start_patch(); if (!patch_exists($patchNumber)) { $addCanceledSQL = "alter table jobs\n modify column status\n enum('available','taken','slicing','downloading','qa','complete','failure','canceled') NOT NULL DEFAULT 'available'"; db()->execute($addCanceledSQL); finish_patch($patchNumber, "Allowing a job to be canceled"); }
<?php include "../../extensions/global.php"; include "../patches.php"; $patchNumber = 9; start_patch(); if (!patch_exists($patchNumber)) { $addDroppedSQL = "ALTER TABLE job_clock\n \t\tMODIFY COLUMN status\n \t\tENUM('idle','slicing','working','waiting','error','maintenance','offline', 'dropped')"; db()->execute($addDroppedSQL); finish_patch($patchNumber, "Adding dropped to the job_clock"); }
<?php include "../../extensions/global.php"; include "../patches.php"; $patchNumber = 4; start_patch(); if (!patch_exists($patchNumber)) { $addPausedSQL = "alter table bots\n modify column status\n enum('idle','slicing','working','paused','waiting','error','maintenance','offline','retired') DEFAULT 'idle'"; db()->execute($addPausedSQL); finish_patch($patchNumber, "Allowing a bot to be paused"); }
<?php include "../../extensions/global.php"; include "../patches.php"; $patchNumber = 2; start_patch(); if (!patch_exists($patchNumber)) { $addRetirementSQL = "alter table bots\n modify column status\n enum('idle','slicing','working','waiting','error','maintenance','offline','retired')\n default 'idle'"; db()->execute($addRetirementSQL); finish_patch($patchNumber, "Allowing a bot to be retired"); }