-
Notifications
You must be signed in to change notification settings - Fork 8
/
gobang.sql
79 lines (71 loc) · 2.8 KB
/
gobang.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
/*
Navicat MySQL Data Transfer
Source Server : 昌维
Source Server Version : 50553
Source Host : localhost:3306
Source Database : gobang
Target Server Type : MYSQL
Target Server Version : 50553
File Encoding : 65001
Date: 2017-02-13 19:00:03
*/
SET FOREIGN_KEY_CHECKS=0;
-- ----------------------------
-- Table structure for gobang_records
-- ----------------------------
DROP TABLE IF EXISTS `gobang_records`;
CREATE TABLE `gobang_records` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`room_id` int(10) unsigned DEFAULT NULL,
`x` varchar(3) DEFAULT NULL,
`y` tinyint(3) unsigned DEFAULT NULL,
`isblack` tinyint(3) unsigned DEFAULT NULL COMMENT '黑方为1,白方为0',
`uid` int(10) unsigned DEFAULT NULL,
`index` smallint(5) unsigned DEFAULT NULL COMMENT '步进',
`record_time` int(10) unsigned DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=MEMORY DEFAULT CHARSET=utf8;
-- ----------------------------
-- Table structure for gobang_rooms
-- ----------------------------
DROP TABLE IF EXISTS `gobang_rooms`;
CREATE TABLE `gobang_rooms` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`black_uid` int(10) unsigned DEFAULT NULL,
`black_seconds` mediumint(5) unsigned DEFAULT NULL COMMENT '黑方读秒',
`white_uid` int(10) unsigned DEFAULT NULL,
`white_seconds` mediumint(5) unsigned DEFAULT NULL,
`last_player` tinyint(3) unsigned DEFAULT NULL COMMENT '黑方先手,但是此处记录是最后行棋者,因此此处默认为2,枚举值:黑方为1,白方为2',
`create_time` int(10) unsigned DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=MEMORY DEFAULT CHARSET=utf8;
-- ----------------------------
-- Table structure for gobang_users
-- ----------------------------
DROP TABLE IF EXISTS `gobang_users`;
CREATE TABLE `gobang_users` (
`id` int(10) unsigned NOT NULL,
`status` tinyint(3) unsigned DEFAULT NULL COMMENT '0表示空闲,1表示黑方,2表示白方,3接受挑战,4拒绝挑战',
`remote_addr` varchar(255) DEFAULT NULL,
`remote_port` varchar(255) DEFAULT NULL,
`request_time` int(10) unsigned DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=MEMORY DEFAULT CHARSET=utf8;
-- ----------------------------
-- Table structure for gobang_users_log
-- ----------------------------
DROP TABLE IF EXISTS `gobang_users_log`;
CREATE TABLE `gobang_users_log` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`remote_addr` varchar(255) DEFAULT NULL,
`remote_port` varchar(255) DEFAULT NULL,
`request_time` int(10) unsigned DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
DROP TRIGGER IF EXISTS `login`;
DELIMITER ;;
CREATE TRIGGER `login` AFTER INSERT ON `gobang_users` FOR EACH ROW BEGIN
insert into gobang_users_log(remote_addr,remote_port,request_time) values(new.remote_addr,new.remote_port,new.request_time);
END
;;
DELIMITER ;