32 lines
847 B
MySQL
32 lines
847 B
MySQL
|
PRAGMA foreign_keys=OFF;
|
||
|
BEGIN TRANSACTION;
|
||
|
CREATE TABLE tunnels (
|
||
|
tun_id INTEGER NOT NULL PRIMARY KEY,
|
||
|
cksum_crc32 INTEGER NOT NULL,
|
||
|
"desc" TEXT,
|
||
|
server_v4 TEXT NOT NULL,
|
||
|
current_client_v4 TEXT NOT NULL,
|
||
|
tunnel_server_v6 TEXT NOT NULL,
|
||
|
tunnel_client_v6 TEXT NOT NULL,
|
||
|
prefix_64 TEXT NOT NULL,
|
||
|
prefix_48 TEXT,
|
||
|
rdns_1 TEXT,
|
||
|
rdns_2 TEXT,
|
||
|
rdns_3 TEXT,
|
||
|
rdns_4 TEXT,
|
||
|
rdns_5 TEXT,
|
||
|
created INTEGER NOT NULL,
|
||
|
checked INTEGER NOT NULL,
|
||
|
updated INTEGER
|
||
|
);
|
||
|
CREATE TABLE client_ips (
|
||
|
id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
|
||
|
tun_id INTEGER NOT NULL,
|
||
|
client_ip INTEGER NOT NULL,
|
||
|
when_set INTEGER NOT NULL, when_fetched INTEGER,
|
||
|
CONSTRAINT client_ips_tunnels_FK FOREIGN KEY (tun_id) REFERENCES tunnels(tun_id) ON DELETE CASCADE ON UPDATE CASCADE
|
||
|
);
|
||
|
INSERT INTO sqlite_sequence VALUES('client_ips',0);
|
||
|
COMMIT;
|
||
|
PRAGMA foreign_keys=ON;
|