From 9072d94106a97ed6f8932902635e75c5d6797b8b Mon Sep 17 00:00:00 2001 From: iAmShorty Date: Mon, 26 May 2014 09:29:46 +0200 Subject: [PATCH 1/6] 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); + } + } + } +} +?> From 62ed5699dcd6664fd8dea4c80071c2f07c4e6651 Mon Sep 17 00:00:00 2001 From: iAmShorty Date: Mon, 26 May 2014 09:30:20 +0200 Subject: [PATCH 2/6] Create 012_shares_archive_update.sql --- sql/012_shares_archive_update.sql | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 sql/012_shares_archive_update.sql diff --git a/sql/012_shares_archive_update.sql b/sql/012_shares_archive_update.sql new file mode 100644 index 00000000..1860a5b7 --- /dev/null +++ b/sql/012_shares_archive_update.sql @@ -0,0 +1,3 @@ +ALTER TABLE shares_archive MODIFY id bigint(30); +ALTER TABLE shares_archive MODIFY share_id bigint(30); +UPDATE TABLE settings SET value = '0.0.11' WHERE name = 'DB_VERSION'; From 5bbc8ac5f7ab31419596da1f3ed71deb626ac6d5 Mon Sep 17 00:00:00 2001 From: iAmShorty Date: Mon, 26 May 2014 09:30:49 +0200 Subject: [PATCH 3/6] Update global.inc.dist.php --- include/config/global.inc.dist.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/config/global.inc.dist.php b/include/config/global.inc.dist.php index ca1069dd..2a357213 100644 --- a/include/config/global.inc.dist.php +++ b/include/config/global.inc.dist.php @@ -7,7 +7,7 @@ $defflip = (!cfip()) ? exit(header('HTTP/1.1 401 Unauthorized')) : 1; * https://github.com/MPOS/php-mpos/wiki/Config-Setup#wiki-config-version **/ $config['version'] = '0.0.8'; -$config['version_url'] = 'https://raw.githubusercontent.com/MPOS/php-mpos/master/public/include/version.inc.php'; +$config['version_url'] = 'https://raw.githubusercontent.com/MPOS/php-mpos/master/include/version.inc.php'; /** * Unless you disable this, we'll do a quick check on your config first. From 8dded88a5773f3eba01b6e990a0dcfa424bb7329 Mon Sep 17 00:00:00 2001 From: iAmShorty Date: Mon, 26 May 2014 09:31:08 +0200 Subject: [PATCH 4/6] Update version.inc.php --- include/version.inc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/version.inc.php b/include/version.inc.php index f0ea33f7..91d93ee8 100644 --- a/include/version.inc.php +++ b/include/version.inc.php @@ -2,7 +2,7 @@ $defflip = (!cfip()) ? exit(header('HTTP/1.1 401 Unauthorized')) : 1; define('MPOS_VERSION', '0.0.4'); -define('DB_VERSION', '0.0.10'); +define('DB_VERSION', '0.0.11'); define('CONFIG_VERSION', '0.0.8'); define('HASH_VERSION', 1); From 7f0f2fffacfd559f86cd2bad384ec27f189db27a Mon Sep 17 00:00:00 2001 From: iAmShorty Date: Mon, 26 May 2014 09:31:43 +0200 Subject: [PATCH 5/6] Update 000_base_structure.sql --- sql/000_base_structure.sql | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sql/000_base_structure.sql b/sql/000_base_structure.sql index 3c55f36c..63f57241 100644 --- a/sql/000_base_structure.sql +++ b/sql/000_base_structure.sql @@ -155,8 +155,8 @@ CREATE TABLE IF NOT EXISTS `shares` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8; CREATE TABLE IF NOT EXISTS `shares_archive` ( - `id` int(255) unsigned NOT NULL AUTO_INCREMENT, - `share_id` int(255) unsigned NOT NULL, + `id` bigint(30) NOT NULL AUTO_INCREMENT, + `share_id` bigint(30) NOT NULL, `username` varchar(120) NOT NULL, `our_result` enum('Y','N') DEFAULT NULL, `upstream_result` enum('Y','N') DEFAULT NULL, From 61f52f46ae129e245ac7bcb96c92fc25922aaa66 Mon Sep 17 00:00:00 2001 From: iAmShorty Date: Tue, 3 Jun 2014 13:00:48 +0200 Subject: [PATCH 6/6] Delete 012_shares_archive_update.sql --- sql/012_shares_archive_update.sql | 3 --- 1 file changed, 3 deletions(-) delete mode 100644 sql/012_shares_archive_update.sql diff --git a/sql/012_shares_archive_update.sql b/sql/012_shares_archive_update.sql deleted file mode 100644 index 1860a5b7..00000000 --- a/sql/012_shares_archive_update.sql +++ /dev/null @@ -1,3 +0,0 @@ -ALTER TABLE shares_archive MODIFY id bigint(30); -ALTER TABLE shares_archive MODIFY share_id bigint(30); -UPDATE TABLE settings SET value = '0.0.11' WHERE name = 'DB_VERSION';