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,
|
2016-12-07 13:46:14 +00:00
|
|
|
`salt` varchar(80) DEFAULT '' not null,
|
2016-12-02 07:38:54 +00:00
|
|
|
`group` int not null,
|
2016-12-13 02:14:14 +00:00
|
|
|
`active` tinyint DEFAULT 0 not null,
|
2016-12-02 07:38:54 +00:00
|
|
|
`is_super_admin` tinyint(1) not null,
|
|
|
|
`createdAt` datetime not null,
|
|
|
|
`lastActiveAt` datetime not null,
|
2016-12-07 13:46:14 +00:00
|
|
|
`session` varchar(200) DEFAULT '' not null,
|
2016-12-18 12:56:06 +00:00
|
|
|
`last_ip` varchar(200) DEFAULT '0.0.0.0.0' not null,
|
2016-12-07 13:46:14 +00:00
|
|
|
`email` varchar(200) DEFAULT '' not null,
|
|
|
|
`avatar` varchar(20) DEFAULT '' not null,
|
2016-12-09 13:46:29 +00:00
|
|
|
`message` text not null,
|
|
|
|
`url_prefix` varchar(20) DEFAULT '' not null,
|
|
|
|
`url_name` varchar(100) DEFAULT '' not null,
|
|
|
|
primary key(`uid`),
|
|
|
|
unique(`name`)
|
2016-12-08 14:11:18 +00:00
|
|
|
) CHARSET=utf8mb4 COLLATE utf8mb4_general_ci;
|
2016-12-02 07:38:54 +00:00
|
|
|
|
|
|
|
CREATE TABLE `users_groups`(
|
|
|
|
`gid` int not null AUTO_INCREMENT,
|
|
|
|
`name` varchar(100) not null,
|
|
|
|
`permissions` text not null,
|
2016-12-07 13:46:14 +00:00
|
|
|
`is_mod` tinyint DEFAULT 0 not null,
|
2016-12-02 07:38:54 +00:00
|
|
|
`is_admin` tinyint DEFAULT 0 not null,
|
2016-12-03 10:25:39 +00:00
|
|
|
`is_banned` tinyint DEFAULT 0 not null,
|
2016-12-07 09:34:09 +00:00
|
|
|
`tag` varchar(50) DEFAULT '' not null,
|
2016-12-02 07:38:54 +00:00
|
|
|
primary key(`gid`)
|
2016-12-08 14:11:18 +00:00
|
|
|
) CHARSET=utf8mb4 COLLATE utf8mb4_general_ci;
|
2016-12-02 07:38:54 +00:00
|
|
|
|
2016-12-03 13:45:08 +00:00
|
|
|
CREATE TABLE `forums`(
|
|
|
|
`fid` int not null AUTO_INCREMENT,
|
|
|
|
`name` varchar(100) not null,
|
2016-12-07 09:34:09 +00:00
|
|
|
`active` tinyint DEFAULT 1 not null,
|
2016-12-03 13:45:08 +00:00
|
|
|
`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-08 14:11:18 +00:00
|
|
|
) CHARSET=utf8mb4 COLLATE utf8mb4_general_ci;
|
2016-12-03 13:45:08 +00:00
|
|
|
|
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-18 12:56:06 +00:00
|
|
|
`ipaddress` varchar(200) DEFAULT '0.0.0.0.0' not null,
|
2016-12-11 16:06:17 +00:00
|
|
|
`data` varchar(200) DEFAULT '' not null,
|
2016-12-02 07:38:54 +00:00
|
|
|
primary key(`tid`)
|
2016-12-08 14:11:18 +00:00
|
|
|
) CHARSET=utf8mb4 COLLATE utf8mb4_general_ci;
|
2016-12-02 07:38:54 +00:00
|
|
|
|
|
|
|
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,
|
2016-12-18 12:56:06 +00:00
|
|
|
`ipaddress` varchar(200) DEFAULT '0.0.0.0.0' not null,
|
2016-12-02 07:38:54 +00:00
|
|
|
primary key(`rid`)
|
2016-12-08 14:11:18 +00:00
|
|
|
) CHARSET=utf8mb4 COLLATE utf8mb4_general_ci;
|
2016-12-02 07:38:54 +00:00
|
|
|
|
2016-12-07 09:34:09 +00:00
|
|
|
CREATE TABLE `users_replies`(
|
|
|
|
`rid` int not null AUTO_INCREMENT,
|
|
|
|
`uid` int not null,
|
|
|
|
`content` text not null,
|
|
|
|
`parsed_content` text not null,
|
|
|
|
`createdAt` datetime not null,
|
|
|
|
`createdBy` int not null,
|
|
|
|
`lastEdit` int not null,
|
|
|
|
`lastEditBy` int not null,
|
|
|
|
primary key(`rid`)
|
2016-12-08 14:11:18 +00:00
|
|
|
) CHARSET=utf8mb4 COLLATE utf8mb4_general_ci;
|
2016-12-07 09:34:09 +00:00
|
|
|
|
2016-12-09 13:46:29 +00:00
|
|
|
CREATE TABLE `settings`(
|
|
|
|
`name` varchar(200) not null,
|
|
|
|
`content` varchar(250) not null,
|
|
|
|
`type` varchar(50) not null,
|
2016-12-16 10:37:42 +00:00
|
|
|
`constraints` varchar(200) DEFAULT '' not null,
|
2016-12-09 13:46:29 +00:00
|
|
|
unique(`name`)
|
|
|
|
);
|
|
|
|
|
2016-12-11 16:06:17 +00:00
|
|
|
CREATE TABLE `plugins`(
|
|
|
|
`uname` varchar(200) not null,
|
|
|
|
`active` tinyint DEFAULT 0 not null,
|
|
|
|
unique(`uname`)
|
|
|
|
);
|
|
|
|
|
2017-01-01 15:45:43 +00:00
|
|
|
CREATE TABLE `themes`(
|
|
|
|
`uname` varchar(200) not null,
|
|
|
|
`default` tinyint DEFAULT 0 not null,
|
|
|
|
unique(`uname`)
|
|
|
|
);
|
|
|
|
|
2016-12-09 13:46:29 +00:00
|
|
|
INSERT INTO settings(`name`,`content`,`type`) VALUES ('url_tags','1','bool');
|
2016-12-21 02:30:32 +00:00
|
|
|
INSERT INTO settings(`name`,`content`,`type`,`constraints`) VALUES ('activation_type','1','list','1-3',);
|
2017-01-01 15:45:43 +00:00
|
|
|
INSERT INTO themes(`uname`,`default`) VALUES ('tempra-simple',1);
|
2016-12-04 10:44:28 +00:00
|
|
|
|
2016-12-23 12:35:22 +00:00
|
|
|
INSERT INTO users(`name`,`email`,`group`,`is_super_admin`,`createdAt`,`lastActiveAt`,`message`)
|
|
|
|
VALUES ('Admin','admin@localhost',1,1,NOW(),NOW(),'');
|
2016-12-08 14:11:18 +00:00
|
|
|
|
2016-12-21 02:30:32 +00:00
|
|
|
/*
|
|
|
|
The Permissions:
|
|
|
|
|
|
|
|
BanUsers
|
|
|
|
ActivateUsers
|
2016-12-23 12:35:22 +00:00
|
|
|
EditUser
|
|
|
|
EditUserEmail
|
|
|
|
EditUserPassword
|
|
|
|
EditUserGroup
|
|
|
|
EditUserGroupSuperMod
|
|
|
|
EditUserGroupAdmin
|
2016-12-21 02:30:32 +00:00
|
|
|
ManageForums
|
|
|
|
EditSettings
|
2017-01-01 15:45:43 +00:00
|
|
|
ManageThemes
|
2016-12-21 02:30:32 +00:00
|
|
|
ManagePlugins
|
|
|
|
ViewIPs
|
|
|
|
|
|
|
|
ViewTopic
|
|
|
|
CreateTopic
|
|
|
|
EditTopic
|
|
|
|
DeleteTopic
|
|
|
|
CreateReply
|
|
|
|
EditReply
|
|
|
|
DeleteReply
|
|
|
|
PinTopic
|
|
|
|
CloseTopic
|
|
|
|
*/
|
|
|
|
|
2017-01-01 15:45:43 +00:00
|
|
|
INSERT INTO users_groups(`name`,`permissions`,`active`,`is_mod`,`is_admin`,`tag`) VALUES ('Administrator','{"BanUsers":true,"ActivateUsers":true,"EditUser":true,"EditUserEmail":true,"EditUserPassword":true,"EditUserGroup":true,"EditUserGroupSuperMod":true,"EditUserGroupAdmin":false,"ManageForums":true,"EditSettings":true,"ManageThemes":true,"ManagePlugins":true,"ViewIPs":true,"ViewTopic":true,"CreateTopic":true,"EditTopic":true,"DeleteTopic":true,"CreateReply":true,"EditReply":true,"DeleteReply":true,"PinTopic":true,"CloseTopic":true}',1,1,1,"Admin");
|
|
|
|
INSERT INTO users_groups(`name`,`permissions`,`is_mod`,`tag`) VALUES ('Moderator','{"BanUsers":true,"ActivateUsers":false,"EditUser":true,"EditUserEmail":false,"EditUserPassword":false,"EditUserGroup":true,"EditUserGroupSuperMod":false,"EditUserGroupAdmin":false,"ManageForums":false,"EditSettings":false,"ManageThemes":false,"ManagePlugins":false,"ViewIPs":true,"ViewTopic":true,"CreateTopic":true,"EditTopic":true,"DeleteTopic":true,"CreateReply":true,"EditReply":true,"DeleteReply":true,"PinTopic":true,"CloseTopic":true}',1,"Mod");
|
|
|
|
INSERT INTO users_groups(`name`,`permissions`) VALUES ('Member','{"BanUsers":false,"ActivateUsers":false,"EditUser":false,"EditUserEmail":false,"EditUserPassword":false,"EditUserGroup":false,"EditUserGroupSuperMod":false,"EditUserGroupAdmin":false,"ManageForums":false,"EditSettings":false,"ManageThemes":false,"ManagePlugins":false,"ViewIPs":false,"ViewTopic":true,"CreateTopic":true,"EditTopic":false,"DeleteTopic":false,"CreateReply":true,"EditReply":false,"DeleteReply":false,"PinTopic":false,"CloseTopic":false}');
|
|
|
|
INSERT INTO users_groups(`name`,`permissions`,`is_banned`) VALUES ('Banned','{"BanUsers":false,"ActivateUsers":false,"EditUser":false,"EditUserEmail":false,"EditUserPassword":false,"EditUserGroup":false,"EditUserGroupSuperMod":false,"EditUserGroupAdmin":false,"ManageForums":false,"EditSettings":false,"ManageThemes":false,"ManagePlugins":false,"ViewIPs":false,"ViewTopic":true,"CreateTopic":false,"EditTopic":false,"DeleteTopic":false,"CreateReply":false,"EditReply":false,"DeleteReply":false,"PinTopic":false,"CloseTopic":false}',1);
|
|
|
|
INSERT INTO users_groups(`name`,`permissions`,`is_banned`) VALUES ('Awaiting Activation','{"BanUsers":false,"ActivateUsers":false,"EditUser":false,"EditUserEmail":false,"EditUserPassword":false,"EditUserGroup":false,"EditUserGroupSuperMod":false,"EditUserGroupAdmin":false,"ManageForums":false,"EditSettings":false,"ManageThemes":false,"ManagePlugins":false,"ViewIPs":false,"ViewTopic":true,"CreateTopic":false,"EditTopic":false,"DeleteTopic":false,"CreateReply":false,"EditReply":false,"DeleteReply":false,"PinTopic":false,"CloseTopic":false}');
|
2016-12-08 14:11:18 +00:00
|
|
|
|
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);
|