-- 矿工历史算力表
CREATE TABLE IF NOT EXISTS nexa_mhsv2(
    id INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
    user VARCHAR(64) NOT NULL,
    miner VARCHAR(64) NOT NULL,
    date DATETIME NOT NULL,
    mhs30m DECIMAL(32, 6) NOT NULL,
    mhs24h DECIMAL(32, 6) NOT NULL,
    state VARCHAR(15) NOT NULL,
    last_submit DATETIME NOT NULL
);

CREATE TABLE IF NOT EXISTS nexa_mhs_realv2(
    id INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
    user VARCHAR(64) NOT NULL,
    miner VARCHAR(64) NOT NULL,
    date DATETIME NOT NULL,
    mhs30m DECIMAL(32, 6) NOT NULL,
    mhs24h DECIMAL(32, 6) NOT NULL,
    state VARCHAR(15) NOT NULL,
    last_submit DATETIME NOT NULL
);

CREATE TABLE IF NOT EXISTS nexa_minersv2(
    id INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
    user VARCHAR(64) NOT NULL,
    miner VARCHAR(64) NOT NULL,
    date DATETIME NOT NULL,
    accepts DECIMAL(16,8) NOT NULL,
    state VARCHAR(10) NOT NULL,
    last_submit DATETIME NOT NULL
);

-- 矿工历史算力表
CREATE TABLE IF NOT EXISTS grs_mhsv2(
    id INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
    user VARCHAR(64) NOT NULL,
    miner VARCHAR(64) NOT NULL,
    date DATETIME NOT NULL,
    mhs30m DECIMAL(32, 6) NOT NULL,
    mhs24h DECIMAL(32, 6) NOT NULL,
    state VARCHAR(15) NOT NULL,
    last_submit DATETIME NOT NULL
);

CREATE TABLE IF NOT EXISTS grs_mhs_realv2(
    id INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
    user VARCHAR(64) NOT NULL,
    miner VARCHAR(64) NOT NULL,
    date DATETIME NOT NULL,
    mhs30m DECIMAL(32, 6) NOT NULL,
    mhs24h DECIMAL(32, 6) NOT NULL,
    state VARCHAR(15) NOT NULL,
    last_submit DATETIME NOT NULL
);

CREATE TABLE IF NOT EXISTS grs_minersv2(
    id INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
    user VARCHAR(64) NOT NULL,
    miner VARCHAR(64) NOT NULL,
    date DATETIME NOT NULL,
    accepts DECIMAL(16,8) NOT NULL,
    state VARCHAR(10) NOT NULL,
    last_submit DATETIME NOT NULL
);

-- 矿工历史算力表
CREATE TABLE IF NOT EXISTS mona_mhsv2(
    id INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
    user VARCHAR(64) NOT NULL,
    miner VARCHAR(64) NOT NULL,
    date DATETIME NOT NULL,
    mhs30m DECIMAL(32, 6) NOT NULL,
    mhs24h DECIMAL(32, 6) NOT NULL,
    state VARCHAR(15) NOT NULL,
    last_submit DATETIME NOT NULL
);

CREATE TABLE IF NOT EXISTS mona_mhs_realv2(
    id INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
    user VARCHAR(64) NOT NULL,
    miner VARCHAR(64) NOT NULL,
    date DATETIME NOT NULL,
    mhs30m DECIMAL(32, 6) NOT NULL,
    mhs24h DECIMAL(32, 6) NOT NULL,
    state VARCHAR(15) NOT NULL,
    last_submit DATETIME NOT NULL
);

CREATE TABLE IF NOT EXISTS mona_minersv2(
    id INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
    user VARCHAR(64) NOT NULL,
    miner VARCHAR(64) NOT NULL,
    date DATETIME NOT NULL,
    accepts DECIMAL(16,8) NOT NULL,
    state VARCHAR(10) NOT NULL,
    last_submit DATETIME NOT NULL
);

-- 矿工历史算力表
CREATE TABLE IF NOT EXISTS dgbs_mhsv2(
    id INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
    user VARCHAR(64) NOT NULL,
    miner VARCHAR(64) NOT NULL,
    date DATETIME NOT NULL,
    mhs30m DECIMAL(32, 6) NOT NULL,
    mhs24h DECIMAL(32, 6) NOT NULL,
    state VARCHAR(15) NOT NULL,
    last_submit DATETIME NOT NULL
);

CREATE TABLE IF NOT EXISTS dgbs_mhs_realv2(
    id INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
    user VARCHAR(64) NOT NULL,
    miner VARCHAR(64) NOT NULL,
    date DATETIME NOT NULL,
    mhs30m DECIMAL(32, 6) NOT NULL,
    mhs24h DECIMAL(32, 6) NOT NULL,
    state VARCHAR(15) NOT NULL,
    last_submit DATETIME NOT NULL
);

CREATE TABLE IF NOT EXISTS dgbs_minersv2(
    id INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
    user VARCHAR(64) NOT NULL,
    miner VARCHAR(64) NOT NULL,
    date DATETIME NOT NULL,
    accepts DECIMAL(16,8) NOT NULL,
    state VARCHAR(10) NOT NULL,
    last_submit DATETIME NOT NULL
);

-- 矿工历史算力表
CREATE TABLE IF NOT EXISTS dgbq_mhsv2(
    id INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
    user VARCHAR(64) NOT NULL,
    miner VARCHAR(64) NOT NULL,
    date DATETIME NOT NULL,
    mhs30m DECIMAL(32, 6) NOT NULL,
    mhs24h DECIMAL(32, 6) NOT NULL,
    state VARCHAR(15) NOT NULL,
    last_submit DATETIME NOT NULL
);

CREATE TABLE IF NOT EXISTS dgbq_mhs_realv2(
    id INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
    user VARCHAR(64) NOT NULL,
    miner VARCHAR(64) NOT NULL,
    date DATETIME NOT NULL,
    mhs30m DECIMAL(32, 6) NOT NULL,
    mhs24h DECIMAL(32, 6) NOT NULL,
    state VARCHAR(15) NOT NULL,
    last_submit DATETIME NOT NULL
);

CREATE TABLE IF NOT EXISTS dgbq_minersv2(
    id INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
    user VARCHAR(64) NOT NULL,
    miner VARCHAR(64) NOT NULL,
    date DATETIME NOT NULL,
    accepts DECIMAL(16,8) NOT NULL,
    state VARCHAR(10) NOT NULL,
    last_submit DATETIME NOT NULL
);

-- 矿工历史算力表
CREATE TABLE IF NOT EXISTS dgbo_mhsv2(
    id INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
    user VARCHAR(64) NOT NULL,
    miner VARCHAR(64) NOT NULL,
    date DATETIME NOT NULL,
    mhs30m DECIMAL(32, 6) NOT NULL,
    mhs24h DECIMAL(32, 6) NOT NULL,
    state VARCHAR(15) NOT NULL,
    last_submit DATETIME NOT NULL
);

CREATE TABLE IF NOT EXISTS dgbo_mhs_realv2(
    id INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
    user VARCHAR(64) NOT NULL,
    miner VARCHAR(64) NOT NULL,
    date DATETIME NOT NULL,
    mhs30m DECIMAL(32, 6) NOT NULL,
    mhs24h DECIMAL(32, 6) NOT NULL,
    state VARCHAR(15) NOT NULL,
    last_submit DATETIME NOT NULL
);

CREATE TABLE IF NOT EXISTS dgbo_minersv2(
    id INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
    user VARCHAR(64) NOT NULL,
    miner VARCHAR(64) NOT NULL,
    date DATETIME NOT NULL,
    accepts DECIMAL(16,8) NOT NULL,
    state VARCHAR(10) NOT NULL,
    last_submit DATETIME NOT NULL
);

CREATE TABLE IF NOT EXISTS nexa_blkreportprofitv2(
    date DATETIME NOT NULL,
    height INT NOT NULL PRIMARY KEY,
    hash VARCHAR(255) NOT NULL,
    reward DECIMAL(18,8) NOT NULL,
    fees DECIMAL(18,8),
    state TINYINT NOT NULL
);

CREATE TABLE IF NOT EXISTS mona_blkreportprofitv2(
    date DATETIME NOT NULL,
    height INT NOT NULL PRIMARY KEY,
    hash VARCHAR(255) NOT NULL,
    reward DECIMAL(18,8) NOT NULL,
    fees DECIMAL(18,8),
    state TINYINT NOT NULL
);

CREATE TABLE IF NOT EXISTS grs_blkreportprofitv2(
    date DATETIME NOT NULL,
    height INT NOT NULL PRIMARY KEY,
    hash VARCHAR(255) NOT NULL,
    reward DECIMAL(18,8) NOT NULL,
    fees DECIMAL(18,8),
    state TINYINT NOT NULL
);

CREATE TABLE IF NOT EXISTS dgbq_blkreportprofitv2(
    date DATETIME NOT NULL,
    height INT NOT NULL PRIMARY KEY,
    hash VARCHAR(255) NOT NULL,
    reward DECIMAL(18,8) NOT NULL,
    fees DECIMAL(18,8),
    state TINYINT NOT NULL
);

CREATE TABLE IF NOT EXISTS dgbo_blkreportprofitv2(
    date DATETIME NOT NULL,
    height INT NOT NULL PRIMARY KEY,
    hash VARCHAR(255) NOT NULL,
    reward DECIMAL(18,8) NOT NULL,
    fees DECIMAL(18,8),
    state TINYINT NOT NULL
);

CREATE TABLE IF NOT EXISTS dgbs_blkreportprofitv2(
    date DATETIME NOT NULL,
    height INT NOT NULL PRIMARY KEY,
    hash VARCHAR(255) NOT NULL,
    reward DECIMAL(18,8) NOT NULL,
    fees DECIMAL(18,8),
    state TINYINT NOT NULL
);



-- 矿工历史算力表
CREATE TABLE IF NOT EXISTS rxd_mhsv2(
    id INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
    user VARCHAR(64) NOT NULL,
    miner VARCHAR(64) NOT NULL,
    date DATETIME NOT NULL,
    mhs30m DECIMAL(32, 6) NOT NULL,
    mhs24h DECIMAL(32, 6) NOT NULL,
    state VARCHAR(15) NOT NULL,
    last_submit DATETIME NOT NULL
);

CREATE TABLE IF NOT EXISTS rxd_mhs_realv2(
    id INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
    user VARCHAR(64) NOT NULL,
    miner VARCHAR(64) NOT NULL,
    date DATETIME NOT NULL,
    mhs30m DECIMAL(32, 6) NOT NULL,
    mhs24h DECIMAL(32, 6) NOT NULL,
    state VARCHAR(15) NOT NULL,
    last_submit DATETIME NOT NULL
);

CREATE TABLE IF NOT EXISTS rxd_minersv2(
    id INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
    user VARCHAR(64) NOT NULL,
    miner VARCHAR(64) NOT NULL,
    date DATETIME NOT NULL,
    accepts DECIMAL(16,8) NOT NULL,
    state VARCHAR(10) NOT NULL,
    last_submit DATETIME NOT NULL
);


CREATE TABLE IF NOT EXISTS rxd_blkreportprofitv2(
    date DATETIME NOT NULL,
    height INT NOT NULL PRIMARY KEY,
    hash VARCHAR(255) NOT NULL,
    reward DECIMAL(18,8) NOT NULL,
    fees DECIMAL(18,8),
    state TINYINT NOT NULL
);

-- 矿工历史算力表
CREATE TABLE IF NOT EXISTS enx_mhsv2(
    id INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
    user VARCHAR(64) NOT NULL,
    miner VARCHAR(64) NOT NULL,
    date DATETIME NOT NULL,
    mhs30m DECIMAL(32, 6) NOT NULL,
    mhs24h DECIMAL(32, 6) NOT NULL,
    state VARCHAR(15) NOT NULL,
    last_submit DATETIME NOT NULL
);

CREATE TABLE IF NOT EXISTS enx_mhs_realv2(
    id INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
    user VARCHAR(64) NOT NULL,
    miner VARCHAR(64) NOT NULL,
    date DATETIME NOT NULL,
    mhs30m DECIMAL(32, 6) NOT NULL,
    mhs24h DECIMAL(32, 6) NOT NULL,
    state VARCHAR(15) NOT NULL,
    last_submit DATETIME NOT NULL
);

CREATE TABLE IF NOT EXISTS enx_minersv2(
    id INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
    user VARCHAR(64) NOT NULL,
    miner VARCHAR(64) NOT NULL,
    date DATETIME NOT NULL,
    accepts DECIMAL(16,8) NOT NULL,
    state VARCHAR(10) NOT NULL,
    last_submit DATETIME NOT NULL
);


CREATE TABLE IF NOT EXISTS enx_blkreportprofitv2(
    date DATETIME NOT NULL,
    height INT NOT NULL PRIMARY KEY,
    hash VARCHAR(255) NOT NULL,
    reward DECIMAL(18,8) NOT NULL,
    fees DECIMAL(18,8),
    state TINYINT NOT NULL
);

-- 矿工历史算力表
CREATE TABLE IF NOT EXISTS alph_mhsv2(
    id INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
    user VARCHAR(64) NOT NULL,
    miner VARCHAR(64) NOT NULL,
    date DATETIME NOT NULL,
    mhs30m DECIMAL(32, 6) NOT NULL,
    mhs24h DECIMAL(32, 6) NOT NULL,
    state VARCHAR(15) NOT NULL,
    last_submit DATETIME NOT NULL
);

CREATE TABLE IF NOT EXISTS alph_mhs_realv2(
    id INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
    user VARCHAR(64) NOT NULL,
    miner VARCHAR(64) NOT NULL,
    date DATETIME NOT NULL,
    mhs30m DECIMAL(32, 6) NOT NULL,
    mhs24h DECIMAL(32, 6) NOT NULL,
    state VARCHAR(15) NOT NULL,
    last_submit DATETIME NOT NULL
);

CREATE TABLE IF NOT EXISTS alph_minersv2(
    id INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
    user VARCHAR(64) NOT NULL,
    miner VARCHAR(64) NOT NULL,
    date DATETIME NOT NULL,
    accepts DECIMAL(16,8) NOT NULL,
    state VARCHAR(10) NOT NULL,
    last_submit DATETIME NOT NULL
);


CREATE TABLE IF NOT EXISTS alph_blkreportprofitv2(
    date DATETIME NOT NULL,
    height INT NOT NULL PRIMARY KEY,
    hash VARCHAR(255) NOT NULL,
    reward DECIMAL(32,8) NOT NULL,
    fees DECIMAL(32,8),
    state TINYINT NOT NULL
);


CREATE TABLE IF NOT EXISTS `alph_pool_blkstats` (
  `id` INT(10) NOT NULL AUTO_INCREMENT,
  `date` DATETIME NOT NULL,
  `height` INT(10),
  `hash` VARCHAR(128),
  `pow` VARCHAR(128),
  `net_target` VARCHAR(128),
  `submit` VARCHAR(64),
  `success` TINYINT(1),
  `accepts` DECIMAL(32,6),
  `rejects` DECIMAL(32,6),
  `reward` DECIMAL(32,6),
  `fee` DECIMAL(32,6),
  `nonce` VARCHAR(64),
  `subidx` INT(10),
  PRIMARY KEY (`id`)
);

CREATE TABLE `alph_miners` (
  `id` INT(10) NOT NULL AUTO_INCREMENT,
  `date` DATETIME NOT NULL,
  `fromip` VARCHAR(64),
  `state` VARCHAR(64),
  `online` DATETIME,
  `offline` DATETIME,
  `retry` INT(10),
  `duration` DECIMAL(12,6),
  `protocol` VARCHAR(64),
  `user` VARCHAR(128),
  `miner` VARCHAR(128),
  `refindex` VARCHAR(128),
  `diff` DECIMAL(32,6),
  `height` INT(10),
  `accepts` DECIMAL(32,6),
  `rejects` DECIMAL(32,6),
  `ratio` DECIMAL(32,6),
  `staleds` DECIMAL(32,6),
  `lows` DECIMAL(32,6),
  `duplicates` DECIMAL(32,6),
  `formats` DECIMAL(32,6),
  `others` DECIMAL(32,6),
  `is_disabled` TINYINT(1),
  `last_submit` DATETIME,
  `submits` INT(10),
  `blocks` INT(10),
  `orphans` INT(10),
  `orphan_ratio` DECIMAL(32,6),
  PRIMARY KEY (`id`)
);

CREATE TABLE `alph_miners_stats` (
  `id` INT(10) NOT NULL AUTO_INCREMENT,
  `date` DATETIME NOT NULL,
  `user` VARCHAR(128),
  `miner` VARCHAR(128),
  `refindex` VARCHAR(128),
  `shares5m` DECIMAL(32,6),
  `shares15m` DECIMAL(32,6),
  `shares30m` DECIMAL(32,6),
  `shares1h` DECIMAL(32,6),
  `shares3h` DECIMAL(32,6),
  `shares6h` DECIMAL(32,6),
  `shares12h` DECIMAL(32,6),
  `shares24h` DECIMAL(32,6),
  `shares48h` DECIMAL(32,6),
  `rejects5m` DECIMAL(32,6),
  `rejects15m` DECIMAL(32,6),
  `rejects30m` DECIMAL(32,6),
  `rejects1h` DECIMAL(32,6),
  `rejects3h` DECIMAL(32,6),
  `rejects6h` DECIMAL(32,6),
  `rejects12h` DECIMAL(32,6),
  `rejects24h` DECIMAL(32,6),
  `rejects48h` DECIMAL(32,6),
  `mhs5m` DECIMAL(32,6),
  `mhs15m` DECIMAL(32,6),
  `mhs30m` DECIMAL(32,6),
  `mhs1h` DECIMAL(32,6),
  `mhs3h` DECIMAL(32,6),
  `mhs6h` DECIMAL(32,6),
  `mhs12h` DECIMAL(32,6),
  `mhs24h` DECIMAL(32,6),
  `mhs48h` DECIMAL(32,6),
  `ratio5m` DECIMAL(32,6),
  `ratio15m` DECIMAL(32,6),
  `ratio30m` DECIMAL(32,6),
  `ratio1h` DECIMAL(32,6),
  `ratio3h` DECIMAL(32,6),
  `ratio6h` DECIMAL(32,6),
  `ratio12h` DECIMAL(32,6),
  `ratio24h` DECIMAL(32,6),
  `ratio48h` DECIMAL(32,6),
  PRIMARY KEY (`id`)
);

CREATE TABLE `alph_blk_height_detail` (
  `id` INT(10) NOT NULL AUTO_INCREMENT,
  `date` DATETIME NOT NULL,
  `from` INT(10),
  `to` INT(10),
  PRIMARY KEY (`id`)
);

CREATE TABLE `alph_blk_detail` (
  `id` INT(10) NOT NULL AUTO_INCREMENT,
  `date` DATETIME NOT NULL,
  `height` INT(10),
  `hash` VARCHAR(128),
  `user` VARCHAR(128),
  `miner` VARCHAR(128),
  `refindex` VARCHAR(128),
  `success` TINYINT(1),
  `miner_diff` DECIMAL(32,6),
  `pool_diff` DECIMAL(32,6),
  `nonce` VARCHAR(64),
  `subidx` INT(10),
  PRIMARY KEY (`id`)
);

CREATE TABLE `alph_blk_new` (
  `id` INT(10) NOT NULL AUTO_INCREMENT,
  `date` DATETIME NOT NULL,
  `height` INT(10),
  `hash` VARCHAR(128),
  `success` TINYINT(1),
  `nonce` VARCHAR(64),
  `subidx` INT(10),
  PRIMARY KEY (`id`)
);