From 9072d94106a97ed6f8932902635e75c5d6797b8b Mon Sep 17 00:00:00 2001 From: iAmShorty Date: Mon, 26 May 2014 09:29:46 +0200 Subject: [PATCH] Create 0.0.10_to_0.0.11.inc.php --- upgrade/definitions/0.0.10_to_0.0.11.inc.php | 31 ++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 upgrade/definitions/0.0.10_to_0.0.11.inc.php diff --git a/upgrade/definitions/0.0.10_to_0.0.11.inc.php b/upgrade/definitions/0.0.10_to_0.0.11.inc.php new file mode 100644 index 00000000..7f332dac --- /dev/null +++ b/upgrade/definitions/0.0.10_to_0.0.11.inc.php @@ -0,0 +1,31 @@ +getValue('DB_VERSION'); // Our actual version installed + + // Upgrade specific variables + $aSql[] = "ALTER TABLE `shares_archive` MODIFY `id` bigint(30)"; + $aSql[] = "ALTER TABLE `shares_archive` MODIFY `share_id` bigint(30)"; + $aSql[] = "UPDATE " . $setting->getTableName() . " SET value = '0.0.11' WHERE name = 'DB_VERSION'"; + + if ($db_version_now == $db_version_old && version_compare($db_version_now, DB_VERSION, '<')) { + // Run the upgrade + echo '- Starting database migration to version ' . $db_version_new . PHP_EOL; + foreach ($aSql as $sql) { + echo '- Preparing: ' . $sql . PHP_EOL; + $stmt = $mysqli->prepare($sql); + if ($stmt && $stmt->execute()) { + echo '- success' . PHP_EOL; + } else { + echo '- failed: ' . $mysqli->error . PHP_EOL; + exit(1); + } + } + } +} +?>