Merge pull request #2386 from MPOS/bigint-blocks-shares
Bigint blocks shares
This commit is contained in:
commit
bc908797b3
@ -1,6 +1,4 @@
|
|||||||
0.0.1 (Mar 7th 2013)
|
1.0.0 (Jan 18th 2015)
|
||||||
--------------------
|
--------------------
|
||||||
|
|
||||||
* WiP Upload of all files currently available
|
* First (non-beta) public release of MPOS
|
||||||
* Added upstream script collections
|
|
||||||
* Added SQL structure
|
|
||||||
|
|||||||
@ -6,7 +6,7 @@ $defflip = (!cfip()) ? exit(header('HTTP/1.1 401 Unauthorized')) : 1;
|
|||||||
* Also the URL to check for the most recent upstream versions available
|
* Also the URL to check for the most recent upstream versions available
|
||||||
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#wiki-config-version
|
* https://github.com/MPOS/php-mpos/wiki/Config-Setup#wiki-config-version
|
||||||
**/
|
**/
|
||||||
$config['version'] = '0.0.8';
|
$config['version'] = '1.0.0';
|
||||||
$config['version_url'] = 'https://raw.githubusercontent.com/MPOS/php-mpos/master/include/version.inc.php';
|
$config['version_url'] = 'https://raw.githubusercontent.com/MPOS/php-mpos/master/include/version.inc.php';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -1,9 +1,9 @@
|
|||||||
<?php
|
<?php
|
||||||
$defflip = (!cfip()) ? exit(header('HTTP/1.1 401 Unauthorized')) : 1;
|
$defflip = (!cfip()) ? exit(header('HTTP/1.1 401 Unauthorized')) : 1;
|
||||||
|
|
||||||
define('MPOS_VERSION', '0.0.4');
|
define('MPOS_VERSION', '1.0.0');
|
||||||
define('DB_VERSION', '0.0.15');
|
define('DB_VERSION', '1.0.0');
|
||||||
define('CONFIG_VERSION', '0.0.8');
|
define('CONFIG_VERSION', '1.0.0');
|
||||||
define('HASH_VERSION', 1);
|
define('HASH_VERSION', 1);
|
||||||
|
|
||||||
// Fetch installed database version
|
// Fetch installed database version
|
||||||
|
|||||||
@ -46,7 +46,7 @@ CREATE TABLE IF NOT EXISTS `blocks` (
|
|||||||
`accounted` tinyint(1) NOT NULL DEFAULT '0',
|
`accounted` tinyint(1) NOT NULL DEFAULT '0',
|
||||||
`account_id` int(255) unsigned DEFAULT NULL,
|
`account_id` int(255) unsigned DEFAULT NULL,
|
||||||
`worker_name` varchar(50) DEFAULT 'unknown',
|
`worker_name` varchar(50) DEFAULT 'unknown',
|
||||||
`shares` int(255) unsigned DEFAULT NULL,
|
`shares` bigint(30) unsigned DEFAULT NULL,
|
||||||
`share_id` bigint(30) DEFAULT NULL,
|
`share_id` bigint(30) DEFAULT NULL,
|
||||||
PRIMARY KEY (`id`),
|
PRIMARY KEY (`id`),
|
||||||
UNIQUE KEY `height` (`height`,`blockhash`),
|
UNIQUE KEY `height` (`height`,`blockhash`),
|
||||||
@ -144,7 +144,7 @@ CREATE TABLE IF NOT EXISTS `settings` (
|
|||||||
UNIQUE KEY `setting` (`name`)
|
UNIQUE KEY `setting` (`name`)
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||||
|
|
||||||
INSERT INTO `settings` (`name`, `value`) VALUES ('DB_VERSION', '0.0.15');
|
INSERT INTO `settings` (`name`, `value`) VALUES ('DB_VERSION', '1.0.0');
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS `shares` (
|
CREATE TABLE IF NOT EXISTS `shares` (
|
||||||
`id` bigint(30) NOT NULL AUTO_INCREMENT,
|
`id` bigint(30) NOT NULL AUTO_INCREMENT,
|
||||||
|
|||||||
@ -1,2 +0,0 @@
|
|||||||
ALTER TABLE `statistics_shares` ADD `pplns_valid` int(11) NOT NULL AFTER `invalid` ;
|
|
||||||
ALTER TABLE `statistics_shares` ADD `pplns_invalid` int(11) NOT NULL DEFAULT 0 AFTER `pplns_valid` ;
|
|
||||||
@ -1 +0,0 @@
|
|||||||
ALTER TABLE `settings` CHANGE `value` `value` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL ;
|
|
||||||
@ -1 +0,0 @@
|
|||||||
ALTER TABLE `monitoring` CHANGE `value` `value` VARCHAR( 255 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL ;
|
|
||||||
@ -1 +0,0 @@
|
|||||||
ALTER TABLE `blocks` ADD `worker_name` varchar(50) DEFAULT 'unknown' AFTER `account_id`;
|
|
||||||
@ -1,7 +0,0 @@
|
|||||||
CREATE TABLE `templates` (
|
|
||||||
`template` varchar(255) NOT NULL,
|
|
||||||
`active` tinyint(1) NOT NULL DEFAULT 0,
|
|
||||||
`content` mediumtext,
|
|
||||||
`modified_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
|
||||||
PRIMARY KEY (`template`)
|
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
|
||||||
@ -1 +0,0 @@
|
|||||||
ALTER TABLE `transactions` ADD `txid` VARCHAR( 256 ) NULL DEFAULT NULL AFTER `timestamp` ;
|
|
||||||
@ -1 +0,0 @@
|
|||||||
ALTER TABLE `accounts` ADD `failed_pins` INT NOT NULL AFTER `failed_logins` ;
|
|
||||||
@ -1,4 +0,0 @@
|
|||||||
ALTER TABLE `shares_archive` ADD INDEX ( `username` ) ;
|
|
||||||
ALTER TABLE `shares_archive` ADD INDEX ( `share_id` ) ;
|
|
||||||
ALTER TABLE `shares_archive` ADD INDEX ( `our_result` ) ;
|
|
||||||
ALTER TABLE `shares_archive` ADD INDEX ( `time` ) ;
|
|
||||||
@ -1,2 +0,0 @@
|
|||||||
ALTER TABLE `token_types` ADD `expiration` INT NULL DEFAULT '0';
|
|
||||||
UPDATE `token_types` SET `expiration` = 3600 WHERE `id` = 1;
|
|
||||||
@ -1 +0,0 @@
|
|||||||
INSERT INTO `token_types` (`name`, `expiration`) VALUES ('account_unlock', 0);
|
|
||||||
@ -1,2 +0,0 @@
|
|||||||
INSERT INTO `settings` (`name`, `value`) VALUES ('DB_VERSION', '0.0.1') ON DUPLICATE KEY UPDATE `value` = '0.0.1';
|
|
||||||
INSERT INTO `settings` (`name`, `value`) VALUES ('db_upgrade_required', 0) ON DUPLICATE KEY UPDATE `value` = 0;
|
|
||||||
30
upgrade/definitions/0.0.15_to_1.0.0.inc.php
Executable file
30
upgrade/definitions/0.0.15_to_1.0.0.inc.php
Executable file
@ -0,0 +1,30 @@
|
|||||||
|
<?php
|
||||||
|
function run_100() {
|
||||||
|
// Ugly but haven't found a better way
|
||||||
|
global $setting, $config, $statistics, $block, $mysqli;
|
||||||
|
|
||||||
|
// Version information
|
||||||
|
$db_version_old = '0.0.15'; // What version do we expect
|
||||||
|
$db_version_new = '1.0.0'; // 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 `blocks` CHANGE `shares` `shares` BIGINT(30) unsigned DEFAULT NULL";
|
||||||
|
$aSql[] = "UPDATE " . $setting->getTableName() . " SET value = '1.0.0' 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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
Loading…
Reference in New Issue
Block a user