· 7 years ago · Feb 01, 2019, 11:58 AM
1CREATE DATABASE IF NOT EXISTS network_monitor;
2
3USE network_monitor;
4
5CREATE TABLE connection_status(
6 conn_id int not null auto_increment primary key,
7 status varchar(255) not null,
8 client_name text,
9 ip varchar(255),
10 timestamp datetime
11) ENGINE=InnoDB;
12
13CREATE TABLE connection_history(
14 conn_hist_id int not null auto_increment primary key,
15 action varchar(255),
16 bytes_received int,
17 bytes_sent int,
18 timestamp datetime
19 conn_id int not null,
20 FOREIGN KEY fk_conn(conn_id )
21 REFERENCES connection_status(conn_id )
22 ON UPDATE CASCADE
23 ON DELETE RESTRICT
24)ENGINE=InnoDB;