Skip to content

Commit bc90879

Browse files
committed
Merge pull request #2386 from MPOS/bigint-blocks-shares
Bigint blocks shares
2 parents 943dcd0 + af69042 commit bc90879

16 files changed

+38
-33
lines changed

Diff for: CHANGELOG.md

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
0.0.1 (Mar 7th 2013)
1+
1.0.0 (Jan 18th 2015)
22
--------------------
33

4-
* WiP Upload of all files currently available
5-
* Added upstream script collections
6-
* Added SQL structure
4+
* First (non-beta) public release of MPOS

Diff for: include/config/global.inc.dist.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* Also the URL to check for the most recent upstream versions available
77
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#wiki-config-version
88
**/
9-
$config['version'] = '0.0.8';
9+
$config['version'] = '1.0.0';
1010
$config['version_url'] = 'https://raw.githubusercontent.com/MPOS/php-mpos/master/include/version.inc.php';
1111

1212
/**

Diff for: include/version.inc.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<?php
22
$defflip = (!cfip()) ? exit(header('HTTP/1.1 401 Unauthorized')) : 1;
33

4-
define('MPOS_VERSION', '0.0.4');
5-
define('DB_VERSION', '0.0.15');
6-
define('CONFIG_VERSION', '0.0.8');
4+
define('MPOS_VERSION', '1.0.0');
5+
define('DB_VERSION', '1.0.0');
6+
define('CONFIG_VERSION', '1.0.0');
77
define('HASH_VERSION', 1);
88

99
// Fetch installed database version

Diff for: sql/000_base_structure.sql

+2-2
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ CREATE TABLE IF NOT EXISTS `blocks` (
4646
`accounted` tinyint(1) NOT NULL DEFAULT '0',
4747
`account_id` int(255) unsigned DEFAULT NULL,
4848
`worker_name` varchar(50) DEFAULT 'unknown',
49-
`shares` int(255) unsigned DEFAULT NULL,
49+
`shares` bigint(30) unsigned DEFAULT NULL,
5050
`share_id` bigint(30) DEFAULT NULL,
5151
PRIMARY KEY (`id`),
5252
UNIQUE KEY `height` (`height`,`blockhash`),
@@ -144,7 +144,7 @@ CREATE TABLE IF NOT EXISTS `settings` (
144144
UNIQUE KEY `setting` (`name`)
145145
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
146146

147-
INSERT INTO `settings` (`name`, `value`) VALUES ('DB_VERSION', '0.0.15');
147+
INSERT INTO `settings` (`name`, `value`) VALUES ('DB_VERSION', '1.0.0');
148148

149149
CREATE TABLE IF NOT EXISTS `shares` (
150150
`id` bigint(30) NOT NULL AUTO_INCREMENT,

Diff for: sql/001_pplns_statistics.sql

-2
This file was deleted.

Diff for: sql/002_settings_update.sql

-1
This file was deleted.

Diff for: sql/003_monitoring_update.sql

-1
This file was deleted.

Diff for: sql/004_blocks_worker.sql

-1
This file was deleted.

Diff for: sql/005_create_templates_table.sql

-7
This file was deleted.

Diff for: sql/006_txid_transactions.sql

-1
This file was deleted.

Diff for: sql/007_accounts_update.sql

-1
This file was deleted.

Diff for: sql/008_shares_archive_optimization.sql

-4
This file was deleted.

Diff for: sql/009_tokentype_update.sql

-2
This file was deleted.

Diff for: sql/010_tokentype_update.sql

-1
This file was deleted.

Diff for: sql/011_db_version.sql

-2
This file was deleted.

Diff for: upgrade/definitions/0.0.15_to_1.0.0.inc.php

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<?php
2+
function run_100() {
3+
// Ugly but haven't found a better way
4+
global $setting, $config, $statistics, $block, $mysqli;
5+
6+
// Version information
7+
$db_version_old = '0.0.15'; // What version do we expect
8+
$db_version_new = '1.0.0'; // What is the new version we wish to upgrade to
9+
$db_version_now = $setting->getValue('DB_VERSION'); // Our actual version installed
10+
11+
// Upgrade specific variables
12+
$aSql[] = "ALTER TABLE `blocks` CHANGE `shares` `shares` BIGINT(30) unsigned DEFAULT NULL";
13+
$aSql[] = "UPDATE " . $setting->getTableName() . " SET value = '1.0.0' WHERE name = 'DB_VERSION'";
14+
15+
if ($db_version_now == $db_version_old && version_compare($db_version_now, DB_VERSION, '<')) {
16+
// Run the upgrade
17+
echo '- Starting database migration to version ' . $db_version_new . PHP_EOL;
18+
foreach ($aSql as $sql) {
19+
echo '- Preparing: ' . $sql . PHP_EOL;
20+
$stmt = $mysqli->prepare($sql);
21+
if ($stmt && $stmt->execute()) {
22+
echo '- success' . PHP_EOL;
23+
} else {
24+
echo '! failed: ' . $mysqli->error . PHP_EOL;
25+
exit(1);
26+
}
27+
}
28+
}
29+
}
30+
?>

0 commit comments

Comments
 (0)