* Added new SQL upgrade and structure * Added post time and author to admin panel * Added post time and author to news list Fixes #226
155 lines
5.7 KiB
SQL
155 lines
5.7 KiB
SQL
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
|
|
SET time_zone = "+00:00";
|
|
|
|
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
|
|
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
|
|
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
|
|
/*!40101 SET NAMES utf8 */;
|
|
|
|
CREATE DATABASE IF NOT EXISTS `mmcfe_ng` DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci;
|
|
USE `mmcfe_ng`;
|
|
|
|
CREATE TABLE IF NOT EXISTS `accounts` (
|
|
`id` int(255) NOT NULL AUTO_INCREMENT,
|
|
`is_admin` tinyint(1) NOT NULL DEFAULT '0',
|
|
`username` varchar(40) NOT NULL,
|
|
`pass` varchar(255) NOT NULL,
|
|
`email` varchar(255) DEFAULT NULL COMMENT 'Assocaited email: used for validating users, and re-setting passwords',
|
|
`is_locked` tinyint(1) NOT NULL DEFAULT '0',
|
|
`failed_logins` int(5) unsigned DEFAULT '0',
|
|
`loggedIp` varchar(255) DEFAULT NULL,
|
|
`sessionTimeoutStamp` int(255) DEFAULT NULL,
|
|
`pin` varchar(255) NOT NULL COMMENT 'four digit pin to allow account changes',
|
|
`api_key` varchar(255) DEFAULT NULL,
|
|
`token` varchar(65) DEFAULT NULL,
|
|
`donate_percent` float DEFAULT '0',
|
|
`ap_threshold` float DEFAULT '0',
|
|
`coin_address` varchar(255) DEFAULT NULL,
|
|
PRIMARY KEY (`id`),
|
|
UNIQUE KEY `username` (`username`)
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
|
|
|
CREATE TABLE IF NOT EXISTS `blocks` (
|
|
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
|
`height` int(10) unsigned NOT NULL,
|
|
`blockhash` char(65) NOT NULL,
|
|
`confirmations` int(10) NOT NULL,
|
|
`amount` double NOT NULL,
|
|
`difficulty` double NOT NULL,
|
|
`time` int(11) NOT NULL,
|
|
`accounted` tinyint(1) NOT NULL DEFAULT '0',
|
|
`account_id` int(255) unsigned DEFAULT NULL,
|
|
`shares` int(255) unsigned DEFAULT NULL,
|
|
`share_id` int(255) DEFAULT NULL,
|
|
PRIMARY KEY (`id`),
|
|
UNIQUE KEY `height` (`height`,`blockhash`),
|
|
KEY `time` (`time`)
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Discovered blocks persisted from Litecoin Service';
|
|
|
|
CREATE TABLE IF NOT EXISTS `news` (
|
|
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
|
`account_id` int(10) unsigned NOT NULL,
|
|
`header` varchar(255) NOT NULL,
|
|
`content` text NOT NULL,
|
|
`time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
`active` tinyint(1) NOT NULL DEFAULT '0',
|
|
PRIMARY KEY (`id`)
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
|
|
|
CREATE TABLE IF NOT EXISTS `notifications` (
|
|
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
|
|
`type` varchar(25) NOT NULL,
|
|
`data` varchar(255) NOT NULL,
|
|
`active` tinyint(1) NOT NULL DEFAULT '1',
|
|
`time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
`account_id` int(10) unsigned DEFAULT NULL,
|
|
PRIMARY KEY (`id`),
|
|
KEY `active` (`active`),
|
|
KEY `data` (`data`),
|
|
KEY `account_id` (`account_id`)
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
|
|
|
CREATE TABLE IF NOT EXISTS `notification_settings` (
|
|
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
|
`type` varchar(15) NOT NULL,
|
|
`account_id` int(11) NOT NULL,
|
|
`active` tinyint(1) NOT NULL DEFAULT '0',
|
|
PRIMARY KEY (`id`)
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
|
|
|
CREATE TABLE IF NOT EXISTS `pool_worker` (
|
|
`id` int(255) NOT NULL AUTO_INCREMENT,
|
|
`account_id` int(255) NOT NULL,
|
|
`username` char(50) DEFAULT NULL,
|
|
`password` char(255) DEFAULT NULL,
|
|
`monitor` tinyint(1) NOT NULL DEFAULT '0',
|
|
PRIMARY KEY (`id`),
|
|
UNIQUE KEY `username` (`username`),
|
|
KEY `account_id` (`account_id`)
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
|
|
|
CREATE TABLE IF NOT EXISTS `settings` (
|
|
`name` varchar(255) NOT NULL,
|
|
`value` varchar(255) DEFAULT NULL,
|
|
PRIMARY KEY (`name`),
|
|
UNIQUE KEY `setting` (`name`)
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
|
|
|
CREATE TABLE IF NOT EXISTS `shares` (
|
|
`id` bigint(30) NOT NULL AUTO_INCREMENT,
|
|
`rem_host` varchar(255) NOT NULL,
|
|
`username` varchar(120) NOT NULL,
|
|
`our_result` enum('Y','N') NOT NULL,
|
|
`upstream_result` enum('Y','N') DEFAULT NULL,
|
|
`reason` varchar(50) DEFAULT NULL,
|
|
`solution` varchar(257) NOT NULL,
|
|
`time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
PRIMARY KEY (`id`),
|
|
KEY `time` (`time`),
|
|
KEY `upstream_result` (`upstream_result`),
|
|
KEY `our_result` (`our_result`),
|
|
KEY `username` (`username`)
|
|
) 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,
|
|
`username` varchar(120) NOT NULL,
|
|
`our_result` enum('Y','N') DEFAULT NULL,
|
|
`upstream_result` enum('Y','N') DEFAULT NULL,
|
|
`block_id` int(10) unsigned NOT NULL,
|
|
`time` datetime NOT NULL,
|
|
PRIMARY KEY (`id`),
|
|
UNIQUE KEY `share_id` (`share_id`),
|
|
KEY `time` (`time`)
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Archive shares for potential later debugging purposes';
|
|
|
|
CREATE TABLE IF NOT EXISTS `statistics_shares` (
|
|
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
|
`account_id` int(10) unsigned NOT NULL,
|
|
`block_id` int(10) unsigned NOT NULL,
|
|
`valid` int(11) NOT NULL,
|
|
`invalid` int(11) NOT NULL DEFAULT '0',
|
|
PRIMARY KEY (`id`),
|
|
KEY `account_id` (`account_id`),
|
|
KEY `block_id` (`block_id`)
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
|
|
|
CREATE TABLE IF NOT EXISTS `transactions` (
|
|
`id` int(255) NOT NULL AUTO_INCREMENT,
|
|
`account_id` int(255) unsigned NOT NULL,
|
|
`type` enum('Credit','Debit_MP','Debit_AP','Donation','Fee','Orphan_Credit','Orphan_Fee','Orphan_Donation','Credit_PPS','Fee_PPS','Donation_PPS','TXFee','Bonus') DEFAULT NULL,
|
|
`coin_address` varchar(255) DEFAULT NULL,
|
|
`amount` double DEFAULT '0',
|
|
`block_id` int(255) DEFAULT NULL,
|
|
`timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
PRIMARY KEY (`id`),
|
|
KEY `block_id` (`block_id`),
|
|
KEY `account_id` (`account_id`),
|
|
KEY `type` (`type`)
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
|
|
|
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
|
|
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
|
|
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|