-- MySQL dump 10.14  Distrib 5.5.41-MariaDB, for Linux (x86_64)
--
-- Host: localhost    Database: marketdb
-- ------------------------------------------------------
-- Server version	5.5.41-MariaDB

--
-- Table structure for table `version`
--

DROP TABLE IF EXISTS `version`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `version` (
  `idx` int(11) NOT NULL AUTO_INCREMENT COMMENT '自增id',
  `version` int(11) NOT NULL DEFAULT '0' COMMENT '版本号',
  PRIMARY KEY (`idx`),
  UNIQUE KEY `version` (`version`)
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `t_box`
--

DROP TABLE IF EXISTS `t_box`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `t_box` (
  `idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id',
  `box_id` varchar(60) NOT NULL DEFAULT '' COMMENT '箱子唯一id',
  `goods_id` int(11) NOT NULL DEFAULT '0' COMMENT 'goods id',
  `goods_idx` int(11) NOT NULL DEFAULT '0' COMMENT 'goods idx',
  `item_id` int(11) NOT NULL DEFAULT '0' COMMENT '道具id',
  `state` int(11) NOT NULL DEFAULT '0' COMMENT 'state 0:待支付 1：支付成功',

  `order_id` varchar(60) NOT NULL DEFAULT '' COMMENT '订单id(订单过期后设置为空)',
  `order_valid` int(11) NOT NULL DEFAULT '0' COMMENT '订单是否有效',
  `owner_address` varchar(60) NOT NULL DEFAULT '' COMMENT '所有者',

  `createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间',
  `modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间',
  PRIMARY KEY (`idx`),
  UNIQUE KEY `box_id` (`box_id`),
  UNIQUE KEY `order_id` (`order_id`),
  KEY `state` (`state`),
  KEY `owner_address` (`owner_address`)
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `t_box_order`
--

DROP TABLE IF EXISTS `t_box_order`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `t_box_order` (
  `idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id',
  `order_id` varchar(60) NOT NULL DEFAULT '' COMMENT '订单id',
  `box_id` varchar(60) NOT NULL DEFAULT '' COMMENT '箱子唯一id',
  `state` int(11) NOT NULL DEFAULT '0' COMMENT 'state 0:待支付 1：支付成功',
  `bc_synced` int(11) NOT NULL DEFAULT '0' COMMENT '0:未上链 1:已上链',
  `bc_sync_count` int(11) NOT NULL DEFAULT '0' COMMENT '本节点同步次数',
  `bc_sync_time` int(11) NOT NULL DEFAULT '0' COMMENT '本节点最后一次同步时间',
  `bc_result` int(11) NOT NULL DEFAULT '0' COMMENT '区块链执行结果 0:失败 1:成功',
  `bc_block_number` varchar(60) NOT NULL DEFAULT '' COMMENT '块id',
  `bc_fail_reason` varchar(255) NOT NULL DEFAULT '' COMMENT '原因',
  `buyer_address` varchar(60) NOT NULL DEFAULT '' COMMENT '购买者',
  `price` bigint NOT NULL DEFAULT '0' COMMENT '价格',
  `payment_token_address` varchar(60) NOT NULL DEFAULT '' COMMENT '货币地址',
  `nonce` varchar(60) NOT NULL DEFAULT '' COMMENT 'nonce',
  `signature` varchar(60) NOT NULL DEFAULT '' COMMENT '签名',
  `buy_time` int(11) NOT NULL DEFAULT '0' COMMENT '购买时间',
  `expired` int(11) NOT NULL DEFAULT '0' COMMENT '是否过期',
  `done` int(11) NOT NULL DEFAULT '0' COMMENT '是否已完成',
  `createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间',
  `modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间',
  PRIMARY KEY (`idx`),
  UNIQUE KEY `order_id` (`order_id`),
  UNIQUE KEY `signature` (`signature`),
  KEY `state` (`state`),
  KEY `self_node_confirm_time` (`self_node_confirm_time`)
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `t_nft`
--

DROP TABLE IF EXISTS `t_nft`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `t_nft` (
  `idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id',
  `token_id` varchar(60) NOT NULL DEFAULT '' COMMENT 'token_id',
  `owner_id` varchar(255) NOT NULL DEFAULT '' COMMENT 'owner_id',
  `owner_address` varchar(255) NOT NULL DEFAULT '' COMMENT 'owner_address',
  `createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间',
  `modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间',
  PRIMARY KEY (`idx`),
  UNIQUE KEY `token_id` (`token_id`)
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `t_log`
--

DROP TABLE IF EXISTS `t_log`;
/*!40101 SET @saved_cs_client      = @@character_set_client */;
/*!40101 SET character_set_client  = utf8 */;
CREATE TABLE `t_log` (
  `idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id',
  `type` varchar(255) NOT NULL DEFAULT '' COMMENT '日志类型',
  `subtype` varchar(255) NOT NULL DEFAULT '' COMMENT '日志子类型',
  `param1` mediumblob COMMENT 'param1',
  `param2` mediumblob COMMENT 'param2',
  `param3` mediumblob COMMENT 'param3',
  `param4` mediumblob COMMENT 'param4',
  `modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间',
  PRIMARY KEY (`idx`)
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
/*!40101 SET character_set_client = @saved_cs_client */;

-- Dump completed on 2015-08-19 18:51:22
