-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathschema.sql
69 lines (56 loc) · 3.37 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
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
69
# Dump of table devices
# ------------------------------------------------------------
CREATE TABLE `devices` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'Autogenerated unique ID',
`group` text COMMENT 'Organizational grouping of this device (may be `NULL`)',
`manufacturer` text COMMENT 'Manufacturer name (may be `NULL`)',
`model` text COMMENT 'Model name (may be `NULL`)',
`name` text COMMENT 'Common name (may be `NULL`)',
`description` longtext COMMENT 'Additional information (may be `NULL`)',
`created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'Timestamp of record creation',
`modified` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT 'Timestamp of last record modification',
PRIMARY KEY (`id`),
UNIQUE KEY `devices_id_uindex` (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
# Dump of table entries
# ------------------------------------------------------------
CREATE TABLE `entries` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'Autogenerated unique ID',
`log_id` int(11) NOT NULL COMMENT 'Database ID of parent log record',
`title` text NOT NULL COMMENT 'Descriptive one-liner title',
`detail` longtext NOT NULL COMMENT 'Markdown-formatted detailed description',
`user_id` int(11) NOT NULL COMMENT 'Database ID of user that created record',
`created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'Timestamp of record creation',
`modified` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'Timestamp of last record modification',
PRIMARY KEY (`id`),
UNIQUE KEY `entries_id_uindex` (`id`),
KEY `entries_users_id_fk` (`user_id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
# Dump of table logs
# ------------------------------------------------------------
CREATE TABLE `logs` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'Autogenerated unique ID',
`name` text COMMENT 'Common name (may be `NULL`)',
`device_id` int(11) NOT NULL COMMENT 'Database ID of parent device',
`created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'Timestamp of record creation',
`modified` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT 'Timestamp of last record modification',
PRIMARY KEY (`id`),
UNIQUE KEY `logs_id_uindex` (`id`),
KEY `logs_devices_id_fk` (`device_id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
# Dump of table users
# ------------------------------------------------------------
CREATE TABLE `users` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'Autogenerated unique ID',
`screen_name` varchar(255) NOT NULL DEFAULT '' COMMENT 'Unique screen name for weakly-authenticated sign-in',
`username` text COMMENT 'Unique username for password-authenticated sign-in (may be `NULL`)',
`password` text COMMENT 'Salted password hash (may be `NULL`)',
`first_name` text COMMENT 'First name (`NULL` if company, may be `NULL`)',
`last_name` text COMMENT 'Last name (company name if not individual, may be `NULL`)',
`email` varchar(255) DEFAULT NULL COMMENT 'Email address (may be `NULL`)',
`created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'Timestamp of record creation',
`modified` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT 'Timestamp of last record modification',
PRIMARY KEY (`id`),
UNIQUE KEY `users_id_uindex` (`id`),
UNIQUE KEY `users_screen_name_uindex` (`screen_name`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;