-- liushl
-- 整理物品功能
drop table if exists goods;
drop table if exists goods_low;
drop table if exists goods_high;
drop table if exists player_transfer;

CREATE TABLE `goods` (
  `id` bigint(20) unsigned NOT NULL DEFAULT '0' COMMENT '物品ID',
  `role_id` bigint(20) unsigned NOT NULL DEFAULT '0' COMMENT '玩家ID',
  `goods_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '物品类型ID',
  `type` mediumint(8) unsigned NOT NULL DEFAULT '0' COMMENT '物品类型',
  `subtype` mediumint(8) unsigned NOT NULL DEFAULT '0' COMMENT '物品子类型',
  `location` smallint(5) unsigned NOT NULL DEFAULT '0' COMMENT '物品所在位置',
  `cell` smallint(5) unsigned NOT NULL DEFAULT '0' COMMENT '物品所在格子位置',
  `num` mediumint(8) unsigned NOT NULL DEFAULT '0' COMMENT '物品数量',
  `create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '物品创建时间',
  `expire_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '有效期，0为无',
  `bind` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '绑定状态，0不绑定，1绑定',
  `extra_data` varchar(5000) NOT NULL DEFAULT '[]' COMMENT '额外数据[{key,value}|_]',
  PRIMARY KEY (`id`, `role_id`),
  KEY `pid` (`role_id`,`location`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='物品信息表'
PARTITION BY LINEAR HASH(role_id) PARTITIONS 10;
