-
Notifications
You must be signed in to change notification settings - Fork 0
/
schema.sql
39 lines (33 loc) · 1.38 KB
/
schema.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
-- Adminer 4.7.1 MySQL dump
SET NAMES utf8;
SET time_zone = '+00:00';
SET foreign_key_checks = 0;
SET sql_mode = 'NO_AUTO_VALUE_ON_ZERO';
DROP TABLE IF EXISTS `messages`;
CREATE TABLE `messages` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`user_id` int(11) DEFAULT NULL,
`timestamp` datetime NOT NULL,
`deleted_by_user_id` int(11) DEFAULT NULL,
`text` tinytext COLLATE utf8_unicode_ci NOT NULL,
`recipient_user_id` int(11) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `user_id` (`user_id`),
KEY `deleted_by_user_id` (`deleted_by_user_id`),
KEY `recipient_user_id` (`recipient_user_id`),
KEY `timestamp` (`timestamp`),
CONSTRAINT `messages_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`),
CONSTRAINT `messages_ibfk_2` FOREIGN KEY (`deleted_by_user_id`) REFERENCES `users` (`id`),
CONSTRAINT `messages_ibfk_3` FOREIGN KEY (`recipient_user_id`) REFERENCES `users` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
DROP TABLE IF EXISTS `users`;
CREATE TABLE `users` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`login` varchar(30) COLLATE utf8_unicode_ci NOT NULL,
`password` varchar(200) COLLATE utf8_unicode_ci NOT NULL,
`name` varchar(30) COLLATE utf8_unicode_ci NOT NULL,
`is_admin` tinyint(1) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`),
UNIQUE KEY `login` (`login`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- 2019-03-24 11:11:34