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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
/*==============================================================*/
/* Nom de SGBD : MySQL 5.0 */
/* Date de cration : 24/11/2020 16:14:35 */
/*==============================================================*/
/*==============================================================*/
/* Table : MJ_BLACKLIST_IP */
/*==============================================================*/
create table MJ_BLACKLIST_IP
(
ID_BLACKLIST int not null auto_increment comment '',
IP varchar(15) not null comment '',
DATE_BAN datetime not null comment '',
primary key (ID_BLACKLIST)
);
/*==============================================================*/
/* Table : MJ_GAME */
/*==============================================================*/
create table MJ_GAME
(
ID_GAME int not null auto_increment comment '',
PRIVATE bool not null comment '',
CREATION_TIME timestamp not null comment '',
primary key (ID_GAME)
);
/*==============================================================*/
/* Table : MJ_ROLE */
/*==============================================================*/
create table MJ_ROLE
(
ID_ROLE int not null auto_increment comment '',
NAME varchar(15) not null comment '',
primary key (ID_ROLE)
);
/*==============================================================*/
/* Table : MJ_USER */
/*==============================================================*/
create table MJ_USER
(
ID_USER int not null auto_increment comment '',
ID_ROLE int comment '',
LOGIN varchar(16) not null comment '',
PASWORD char(40) not null comment '',
AVATAR char(255) comment '',
LASTNAME char(55) comment '',
FIRSTNAME char(55) comment '',
MAIL char(64) not null comment '',
BAN_ACCOUNT bool comment '',
LAST_IP varchar(15) comment '',
primary key (ID_USER),
constraint FK_MJ_USER_MJ_HAS_MJ_ROLE foreign key (ID_ROLE)
references MJ_ROLE (ID_ROLE) on delete restrict on update restrict
);
/*==============================================================*/
/* Table : MJ_ROUND */
/*==============================================================*/
create table MJ_ROUND
(
ID_ROUND int not null auto_increment comment '',
ID_GAME int comment '',
PREVAILING_WIND int not null comment '',
SEED int not null comment '',
BEGINING timestamp comment '',
ENDING timestamp comment '',
ACTIONS text comment '',
primary key (ID_ROUND),
constraint FK_MJ_ROUND_MJ_COMPOS_MJ_GAME foreign key (ID_GAME)
references MJ_GAME (ID_GAME) on delete restrict on update restrict
);
/*==============================================================*/
/* Table : MJ_PLAY */
/*==============================================================*/
create table MJ_PLAY
(
ID_USER int not null comment '',
ID_ROUND int not null comment '',
WIN bool comment '',
SCORE int comment '',
HOST bool comment '',
WIND int comment '',
primary key (ID_USER, ID_ROUND),
constraint FK_MJ_PLAY_PLAY2_MJ_USER foreign key (ID_USER)
references MJ_USER (ID_USER) on delete restrict on update restrict,
constraint FK_MJ_PLAY_MJ_PLAY_MJ_ROUND foreign key (ID_ROUND)
references MJ_ROUND (ID_ROUND) on delete restrict on update restrict
);