forked from vvye/simpson
-
Notifications
You must be signed in to change notification settings - Fork 0
/
database.sql
45 lines (37 loc) · 1.17 KB
/
database.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
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";
CREATE DATABASE IF NOT EXISTS `minis` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
USE `minis`;
CREATE TABLE `messages` (
`id` int(11) NOT NULL,
`user` int(11) NOT NULL,
`addressee` int(11) DEFAULT NULL,
`parent` int(11) DEFAULT NULL,
`post_time` int(11) NOT NULL,
`content` longtext NOT NULL,
`deleted` tinyint(1) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `users` (
`id` int(11) NOT NULL,
`first_name` varchar(100) NOT NULL,
`last_name` varchar(100) NOT NULL,
`email` varchar(100) NOT NULL,
`password` varchar(100) NOT NULL,
`email_public` tinyint(4) NOT NULL DEFAULT '0',
`bio` longtext NOT NULL,
`registration_time` int(11) NOT NULL,
`last_activity_time` int(11) NOT NULL,
`csrf_token` varchar(16) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
ALTER TABLE `messages`
ADD PRIMARY KEY (`id`);
ALTER TABLE `users`
ADD UNIQUE KEY `email` (`email`),
ADD KEY `id` (`id`);
ALTER TABLE `messages`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
ALTER TABLE `users`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
COMMIT;