-
Notifications
You must be signed in to change notification settings - Fork 0
/
init.sql
68 lines (61 loc) · 2.11 KB
/
init.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
drop database testdb;
create database testdb;
use testdb;
create table `users` (
`id` mediumint unsigned auto_increment not null,
`email` char(32) not null unique,
`username` char(32) not null,
`name` char(64) not null,
`isAnonymous` tinyint unsigned not null default '0',
`about` TEXT,
primary key (`id`)
) engine=InnoDB default charset=cp1251;
create table `follow` (
`follower_id` mediumint unsigned not null,
`followee_id` mediumint unsigned not null,
primary key (`follower_id`, `followee_id`)
) engine=InnoDB default charset=cp1251;
create table `forum` (
`id` mediumint unsigned auto_increment not null,
`user_email` char(32) not null,
`name` varchar(255) not null unique ,
`short_name` varchar(255) not null unique,
`date_of_creating` TIMESTAMP default NOW(),
primary key (`id`)
) engine=InnoDB default charset=cp1251;
create table `thread` (
`id` mediumint unsigned auto_increment not null unique,
`isDeleted` tinyint unsigned not null default '0',
`isClosed` tinyint unsigned not null default '0',
`user_email` char(32) not null,
`forum` varchar(255) not null,
`message` LONGTEXT not null,
`title` char(255) not null,
`slug` char(255) not null,
`date_of_creating` TIMESTAMP default NOW(),
`likes` mediumint default 0,
`dislikes` mediumint default 0,
primary key (`id`)
) engine=InnoDB default charset=cp1251;
create table `post` (
`id` mediumint unsigned auto_increment not null,
`isDeleted` tinyint unsigned not null default '0',
`isEdited` tinyint unsigned not null default '0',
`isApproved` tinyint unsigned not null default '0',
`isSpam` tinyint unsigned not null default '0',
`isHighlighted` tinyint unsigned not null default '0',
`user_email` char(32) not null,
`forum` varchar(255) not null,
`thread` mediumint unsigned not null,
`parent` varchar(255) not null,
`message` LONGTEXT not null,
`date_of_creating` TIMESTAMP default NOW(),
`likes` mediumint default 0,
`dislikes` mediumint default 0,
primary key (`id`)
) engine=InnoDB default charset=cp1251;
create table `subscribtion` (
`user_id` mediumint unsigned not null,
`thread_id` mediumint unsigned not null,
primary key (`user_id`, `thread_id`)
) engine=InnoDB default charset=cp1251;