function run_006() { // Ugly but haven't found a better way global $setting; // Version information $db_version_old = '0.0.5'; // What version do we expect $db_version_new = '0.0.6'; // What is the new version we wish to upgrade to $db_version_now = $setting->getValue('DB_VERSION'); // Our actual version installed // Upgrade specific variables $aSql[] = "CREATE INDEX `account_id_archived` ON `transactions` (`account_id`,`archived`)"; $aSql[] = "INSERT INTO `settings` (`name`, `value`) VALUES ('DB_VERSION', '0.0.6') ON DUPLICATE KEY UPDATE `value` = '0.0.6'"; if ($db_version_now == $db_version_old && version_compare($db_version_now, DB_VERSION, '<')) { execute_db_upgrade($aSql); } }
function run_002() { // Ugly but haven't found a better way global $setting; // Version information $db_version_old = '0.0.1'; // What version do we expect $db_version_new = '0.0.2'; // What is the new version we wish to upgrade to $db_version_now = $setting->getValue('DB_VERSION'); // Our actual version installed // Upgrade specific variables $aSql[] = "ALTER TABLE `accounts` CHANGE `sessionTimeoutStamp` `last_login` INT( 10 ) NULL DEFAULT NULL"; $aSql[] = "INSERT INTO `settings` (`name`, `value`) VALUES ('DB_VERSION', '0.0.2') ON DUPLICATE KEY UPDATE `value` = '0.0.2'"; if ($db_version_now == $db_version_old && version_compare($db_version_now, DB_VERSION, '<')) { execute_db_upgrade($aSql); } }
function run_005() { // Ugly but haven't found a better way global $setting; // Version information $db_version_old = '0.0.4'; // What version do we expect $db_version_new = '0.0.5'; // What is the new version we wish to upgrade to $db_version_now = $setting->getValue('DB_VERSION'); // Our actual version installed // Upgrade specific variables $aSql[] = "UPDATE `accounts` SET `coin_address` = NULL WHERE `coin_address` = ''"; $aSql[] = "ALTER TABLE `accounts` ADD UNIQUE INDEX ( `coin_address` )"; $aSql[] = "INSERT INTO `settings` (`name`, `value`) VALUES ('DB_VERSION', '0.0.5') ON DUPLICATE KEY UPDATE `value` = '0.0.5'"; if ($db_version_now == $db_version_old && version_compare($db_version_now, DB_VERSION, '<')) { execute_db_upgrade($aSql); } }
function run_004() { // Ugly but haven't found a better way global $setting; // Version information $db_version_old = '0.0.3'; // What version do we expect $db_version_new = '0.0.4'; // What is the new version we wish to upgrade to $db_version_now = $setting->getValue('DB_VERSION'); // Our actual version installed // Upgrade specific variables $aSql[] = "ALTER TABLE `accounts` ADD COLUMN `signup_timestamp` INT( 10 ) NOT NULL DEFAULT '0' AFTER `failed_pins`"; $aSql[] = "ALTER TABLE `accounts` ADD COLUMN `notify_email` VARCHAR( 255 ) NULL DEFAULT NULL AFTER `email`"; $aSql[] = "TRUNCATE TABLE `token_types`"; $aSql[] = "INSERT INTO `token_types` (`id`, `name`, `expiration`) VALUES (1, 'password_reset', 3600), (2, 'confirm_email', 0), (3, 'invitation', 0), (4, 'account_unlock', 0), (5, 'account_edit', 3600), (6, 'change_pw', 3600), (7, 'withdraw_funds', 3600)"; $aSql[] = "INSERT INTO `settings` (`name`, `value`) VALUES ('DB_VERSION', '0.0.4') ON DUPLICATE KEY UPDATE `value` = '0.0.4'"; if ($db_version_now == $db_version_old && version_compare($db_version_now, DB_VERSION, '<')) { execute_db_upgrade($aSql); } }
function run_003() { // Ugly but haven't found a better way global $setting; // Version information $db_version_old = '0.0.2'; // What version do we expect $db_version_new = '0.0.3'; // What is the new version we wish to upgrade to $db_version_now = $setting->getValue('DB_VERSION'); // Our actual version installed // Upgrade specific variables $aSql[] = "INSERT INTO `token_types` (`name`, `expiration`) VALUES ('account_edit', 360)"; $aSql[] = "INSERT INTO `token_types` (`name`, `expiration`) VALUES ('change_pw', 360)"; $aSql[] = "INSERT INTO `token_types` (`name`, `expiration`) VALUES ('withdraw_funds', 360)"; $aSql[] = "CREATE INDEX `account_id` ON `notification_settings` (`account_id`)"; $aSql[] = "CREATE UNIQUE INDEX `account_id_type` ON `notification_settings` (`account_id`,`type`)"; $aSql[] = "INSERT INTO `settings` (`name`, `value`) VALUES ('DB_VERSION', '0.0.3') ON DUPLICATE KEY UPDATE `value` = '0.0.3'"; if ($db_version_now == $db_version_old && version_compare($db_version_now, DB_VERSION, '<')) { execute_db_upgrade($aSql); } }