schema.sql 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. CREATE DATABASE `urlooker`;
  2. USE urlooker;
  3. #DROP TABLE IF EXISTS `strategy`;
  4. CREATE TABLE `strategy` (
  5. `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  6. `url` varchar(1024) NOT NULL,
  7. `idc` varchar(255) NOT NULL DEFAULT '',
  8. `enable` int(1) NOT NULL DEFAULT 1,
  9. `keywords` varchar(255) NOT NULL DEFAULT '',
  10. `endpoint` varchar(255) NOT NULL DEFAULT '',
  11. `timeout` varchar(255) NOT NULL DEFAULT '',
  12. `creator` varchar(255) NOT NULL DEFAULT '',
  13. `data` text,
  14. `ip` varchar(255) NOT NULL DEFAULT '',
  15. `expect_code` varchar(255) NOT NULL DEFAULT '',
  16. `tag` varchar(255) NOT NULL DEFAULT '',
  17. `header` text,
  18. `method` varchar(255) DEFAULT "get",
  19. `post_data` text,
  20. `note` text,
  21. `max_step` int(4) NOT NULL DEFAULT 3,
  22. `times` int(4) NOT NULL DEFAULT 3,
  23. `teams` varchar(32) NOT NULL DEFAULT '',
  24. PRIMARY KEY (`id`)
  25. ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
  26. #ALTER TABLE strategy ADD ip varchar(255);
  27. #ALTER TABLE strategy ADD enable int(1) DEFAULT 1;
  28. #ALTER TABLE strategy ADD endpoint varchar(255) DEFAULT "";
  29. #ALTER TABLE strategy ADD method varchar(255) DEFAULT "";
  30. #ALTER TABLE strategy ADD header text;
  31. #ALTER TABLE strategy ADD post_data text;
  32. #ALTER TABLE strategy ADD idc varchar(255);
  33. #DROP TABLE IF EXISTS `user`;
  34. CREATE TABLE `user` (
  35. `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
  36. `name` VARCHAR(64) NOT NULL,
  37. `cnname` VARCHAR(64) NOT NULL DEFAULT '',
  38. `password` VARCHAR(32) NOT NULL,
  39. `email` VARCHAR(255) NOT NULL DEFAULT '',
  40. `phone` VARCHAR(16) NOT NULL DEFAULT '',
  41. `wechat` VARCHAR(255) NOT NULL DEFAULT '',
  42. `role` TINYINT NOT NULL DEFAULT 0,
  43. `created` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
  44. PRIMARY KEY (`id`),
  45. UNIQUE KEY `idx_user_name` (`name`)
  46. ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
  47. #DROP TABLE if EXISTS team;
  48. CREATE TABLE `team` (
  49. `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
  50. `name` VARCHAR(64) NOT NULL,
  51. `resume` VARCHAR(255) NOT NULL DEFAULT '',
  52. `creator` BIGINT UNSIGNED NOT NULL,
  53. `created` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
  54. PRIMARY KEY (`id`),
  55. UNIQUE KEY `idx_team_name` (`name`)
  56. ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
  57. #DROP TABLE if EXISTS `rel_team_user`;
  58. CREATE TABLE `rel_team_user` (
  59. `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
  60. `tid` BIGINT UNSIGNED NOT NULL,
  61. `uid` BIGINT UNSIGNED NOT NULL,
  62. PRIMARY KEY (`id`),
  63. KEY `idx_rel_tid` (`tid`),
  64. KEY `idx_rel_uid` (`uid`)
  65. ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
  66. #DROP TABLE IF EXISTS `rel_sid_ip`;
  67. CREATE TABLE `rel_sid_ip` (
  68. `id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
  69. `sid` INT UNSIGNED NOT NULL,
  70. `ip` VARCHAR(32) NOT NULL DEFAULT '',
  71. `ts` INT(10),
  72. PRIMARY KEY (`id`),
  73. UNIQUE KEY `idx_sid_ip` (`sid`,`ip`)
  74. ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
  75. #DROP TABLE IF EXISTS `event`;
  76. CREATE TABLE `event` (
  77. `id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
  78. `event_id` VARCHAR(64) NOT NULL,
  79. `status` VARCHAR(32) NOT NULL,
  80. `url` VARCHAR(256) NOT NULL DEFAULT '',
  81. `ip` VARCHAR(32) NOT NULL DEFAULT '',
  82. `strategy_id` INT,
  83. `event_time` INT(11),
  84. `resp_time` INT(6),
  85. `resp_code` VARCHAR(3),
  86. `result` INT(1) NOT NULL DEFAULT 0 COMMENT '0:no error, 1:timeout, 2:expect code err, 3,keyword unmatch 4:dns err',
  87. `current_step`INT(1),
  88. `max_step` INT(1),
  89. PRIMARY KEY (`id`),
  90. INDEX `idx_strategy_id` (`strategy_id`)
  91. ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
  92. #DROP TABLE IF EXISTS `item_status00`;
  93. CREATE TABLE `item_status00` (
  94. `id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
  95. `sid` INT UNSIGNED NOT NULL,
  96. `ip` VARCHAR(32) NOT NULL DEFAULT '',
  97. `resp_time` INT(6),
  98. `resp_code` VARCHAR(3),
  99. `push_time` INT(10),
  100. `result` INT(1) NOT NULL DEFAULT 0 COMMENT '0:no error, 1:timeout, 2:expect code err, 3,keyword unmatch 4:dns err',
  101. PRIMARY KEY (`id`),
  102. INDEX `idx_ip` (`ip`),
  103. INDEX `idx_sid` (`sid`)
  104. ) ENGINE=InnoDB DEFAULT CHARSET=utf8;