-
Notifications
You must be signed in to change notification settings - Fork 6
/
db.sql
52 lines (43 loc) · 1.5 KB
/
db.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
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
START TRANSACTION;
SET time_zone = "+00:00";
CREATE TABLE if not exists `logs` (
`log_id` int(11) NOT NULL PRIMARY KEY,
`website_id` int(11) NOT NULL,
`timestamp` datetime NOT NULL DEFAULT current_timestamp(),
`status` int(11) NOT NULL COMMENT 'http response',
`response_time` float NOT NULL COMMENT 'response time in second'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
CREATE TABLE if not exists `users` (
`user_id` int(11) NOT NULL PRIMARY KEY,
`email` varchar(255) NOT NULL ,
`password` varchar(255) NOT NULL,
`plan` int(11) NOT NULL,
`isActive` int(11) NOT NULL,
`timestamp` datetime NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
CREATE TABLE if not exists `websites` (
`website_id` int(11) NOT NULL PRIMARY KEY ,
`website_name` varchar(255) NOT NULL,
`tags` varchar(255) NOT NULL,
`link` varchar(250) NOT NULL,
`interval` int(2) NOT NULL,
`user_id` int(11) NOT NULL,
`timestamp` datetime NOT NULL DEFAULT current_timestamp(),
`isActive` int(11) NOT NULL DEFAULT 1
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*
ALTER TABLE `logs`
ADD PRIMARY KEY (`log_id`);
ALTER TABLE `users`
ADD PRIMARY KEY (`user_id`);
ALTER TABLE `websites`
ADD PRIMARY KEY (`website_id`);
*/
ALTER TABLE `logs`
MODIFY `log_id` int(11) NOT NULL AUTO_INCREMENT;
ALTER TABLE `users`
MODIFY `user_id` int(11) NOT NULL AUTO_INCREMENT;
ALTER TABLE `websites`
MODIFY `website_id` int(11) NOT NULL AUTO_INCREMENT;
COMMIT;