db.sql 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. CREATE TABLE `tiny_id_info` (
  2. `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '自增主键',
  3. `biz_type` varchar(63) NOT NULL DEFAULT '' COMMENT '业务类型,唯一',
  4. `begin_id` bigint(20) NOT NULL DEFAULT '0' COMMENT '开始id,仅记录初始值,无其他含义。初始化时begin_id和max_id应相同',
  5. `max_id` bigint(20) NOT NULL DEFAULT '0' COMMENT '当前最大id',
  6. `step` int(11) DEFAULT '0' COMMENT '步长',
  7. `delta` int(11) NOT NULL DEFAULT '1' COMMENT '每次id增量',
  8. `remainder` int(11) NOT NULL DEFAULT '0' COMMENT '余数',
  9. `create_time` timestamp NOT NULL DEFAULT '2010-01-01 00:00:00' COMMENT '创建时间',
  10. `update_time` timestamp NOT NULL DEFAULT '2010-01-01 00:00:00' COMMENT '更新时间',
  11. `version` bigint(20) NOT NULL DEFAULT '0' COMMENT '版本号',
  12. PRIMARY KEY (`id`),
  13. UNIQUE KEY `uniq_biz_type` (`biz_type`)
  14. ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COMMENT 'id信息表';
  15. CREATE TABLE `tiny_id_token` (
  16. `id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增id',
  17. `token` varchar(255) NOT NULL DEFAULT '' COMMENT 'token',
  18. `biz_type` varchar(63) NOT NULL DEFAULT '' COMMENT '此token可访问的业务类型标识',
  19. `remark` varchar(255) NOT NULL DEFAULT '' COMMENT '备注',
  20. `create_time` timestamp NOT NULL DEFAULT '2010-01-01 00:00:00' COMMENT '创建时间',
  21. `update_time` timestamp NOT NULL DEFAULT '2010-01-01 00:00:00' COMMENT '更新时间',
  22. PRIMARY KEY (`id`)
  23. ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COMMENT 'token信息表';
  24. INSERT INTO `tiny_id_info` (`id`, `biz_type`, `begin_id`, `max_id`, `step`, `delta`, `remainder`, `create_time`, `update_time`, `version`)
  25. VALUES
  26. (1, 'test', 1, 1, 100000, 1, 0, '2018-07-21 23:52:58', '2018-07-22 23:19:27', 1);
  27. INSERT INTO `tiny_id_info` (`id`, `biz_type`, `begin_id`, `max_id`, `step`, `delta`, `remainder`, `create_time`, `update_time`, `version`)
  28. VALUES
  29. (2, 'test_odd', 1, 1, 100000, 2, 1, '2018-07-21 23:52:58', '2018-07-23 00:39:24', 3);
  30. INSERT INTO `tiny_id_token` (`id`, `token`, `biz_type`, `remark`, `create_time`, `update_time`)
  31. VALUES
  32. (1, '0f673adf80504e2eaa552f5d791b644c', 'test', '1', '2017-12-14 16:36:46', '2017-12-14 16:36:48');
  33. INSERT INTO `tiny_id_token` (`id`, `token`, `biz_type`, `remark`, `create_time`, `update_time`)
  34. VALUES
  35. (2, '0f673adf80504e2eaa552f5d791b644c', 'test_odd', '1', '2017-12-14 16:36:46', '2017-12-14 16:36:48');