2016-12-02 07:38:54 +00:00
|
|
|
CREATE DATABASE grosolo;
|
|
|
|
|
|
|
|
CREATE TABLE `users`(
|
|
|
|
`uid` int not null AUTO_INCREMENT,
|
|
|
|
`name` varchar(100) not null,
|
|
|
|
`password` varchar(100) not null,
|
|
|
|
`salt` varchar(80) DEFAULT '',
|
|
|
|
`group` int not null,
|
|
|
|
`is_super_admin` tinyint(1) not null,
|
|
|
|
`createdAt` datetime not null,
|
|
|
|
`lastActiveAt` datetime not null,
|
|
|
|
`session` varchar(200) DEFAULT '',
|
2016-12-03 10:25:39 +00:00
|
|
|
`email` varchar(200) DEFAULT '',
|
2016-12-02 15:03:31 +00:00
|
|
|
`avatar` varchar(20) DEFAULT '',
|
2016-12-02 07:38:54 +00:00
|
|
|
primary key(`uid`)
|
|
|
|
);
|
|
|
|
|
|
|
|
CREATE TABLE `users_groups`(
|
|
|
|
`gid` int not null AUTO_INCREMENT,
|
|
|
|
`name` varchar(100) not null,
|
|
|
|
`permissions` text not null,
|
|
|
|
`is_admin` tinyint DEFAULT 0 not null,
|
2016-12-03 10:25:39 +00:00
|
|
|
`is_banned` tinyint DEFAULT 0 not null,
|
2016-12-02 07:38:54 +00:00
|
|
|
primary key(`gid`)
|
|
|
|
);
|
|
|
|
|
2016-12-03 13:45:08 +00:00
|
|
|
CREATE TABLE `forums`(
|
|
|
|
`fid` int not null AUTO_INCREMENT,
|
|
|
|
`name` varchar(100) not null,
|
|
|
|
`lastTopic` varchar(100) DEFAULT '' not null,
|
|
|
|
`lastTopicID` int DEFAULT 0 not null,
|
|
|
|
`lastReplyer` varchar(100) DEFAULT '' not null,
|
|
|
|
`lastReplyerID` int DEFAULT 0 not null,
|
|
|
|
`lastTopicTime` datetime not null,
|
|
|
|
primary key(`fid`)
|
|
|
|
);
|
|
|
|
|
2016-12-02 07:38:54 +00:00
|
|
|
CREATE TABLE `topics`(
|
|
|
|
`tid` int not null AUTO_INCREMENT,
|
|
|
|
`title` varchar(100) not null,
|
|
|
|
`content` text not null,
|
2016-12-03 05:00:21 +00:00
|
|
|
`parsed_content` text not null,
|
2016-12-02 07:38:54 +00:00
|
|
|
`createdAt` datetime not null,
|
|
|
|
`lastReplyAt` datetime not null,
|
|
|
|
`createdBy` int not null,
|
|
|
|
`is_closed` tinyint DEFAULT 0 not null,
|
|
|
|
`sticky` tinyint DEFAULT 0 not null,
|
2016-12-03 13:45:08 +00:00
|
|
|
`parentID` int DEFAULT 1 not null,
|
2016-12-02 07:38:54 +00:00
|
|
|
primary key(`tid`)
|
|
|
|
);
|
|
|
|
|
|
|
|
CREATE TABLE `replies`(
|
|
|
|
`rid` int not null AUTO_INCREMENT,
|
|
|
|
`tid` int not null,
|
|
|
|
`content` text not null,
|
2016-12-03 05:00:21 +00:00
|
|
|
`parsed_content` text not null,
|
2016-12-02 07:38:54 +00:00
|
|
|
`createdAt` datetime not null,
|
|
|
|
`createdBy` int not null,
|
|
|
|
`lastEdit` int not null,
|
|
|
|
`lastEditBy` int not null,
|
|
|
|
primary key(`rid`)
|
|
|
|
);
|
|
|
|
|
2016-12-04 10:44:28 +00:00
|
|
|
CREATE TABLE `replies_reports` (
|
|
|
|
`rid` int not null AUTO_INCREMENT,
|
|
|
|
`reportedBy` int not null,
|
|
|
|
`reportedContent` text not null,
|
|
|
|
`resolved` tinyint DEFAULT 0 not null,
|
|
|
|
primary key(`rid`)
|
|
|
|
);
|
|
|
|
|
2016-12-02 07:38:54 +00:00
|
|
|
INSERT INTO users(`name`,`group`,`is_super_admin`,`createdAt`,`lastActiveAt`)
|
|
|
|
VALUES ('Admin',1,1,NOW(),NOW());
|
|
|
|
INSERT INTO users_groups(`name`,`permissions`,`is_admin`) VALUES ('Administrator','{}',1);
|
2016-12-04 06:16:59 +00:00
|
|
|
INSERT INTO users_groups(`name`,`permissions`) VALUES ('Member','{}');
|
2016-12-03 13:45:08 +00:00
|
|
|
INSERT INTO forums(`name`,`lastTopicTime`) VALUES ('General',NOW());
|
2016-12-02 07:38:54 +00:00
|
|
|
INSERT INTO topics(`title`,`content`,`createdAt`,`lastReplyAt`,`createdBy`,`parentID`)
|
|
|
|
VALUES ('Test Topic','A topic automatically generated by the software.',NOW(),NOW(),1,1);
|
|
|
|
|
|
|
|
INSERT INTO replies(`tid`,`content`,`createdAt`,`createdBy`,`lastEdit`,`lastEditBy`)
|
|
|
|
VALUES (1,'Reply 1',NOW(),1,0,0);
|