59 lines
1.5 KiB
SQL
59 lines
1.5 KiB
SQL
-- Location of the served file
|
|
CREATE TABLE paths (
|
|
-- The path string
|
|
path text UNIQUE NOT NULL,
|
|
-- The id of the path string
|
|
id serial PRIMARY KEY NOT NULL
|
|
);
|
|
|
|
-- Host header strings
|
|
CREATE TABLE hosts (
|
|
-- Host header value
|
|
host text UNIQUE NOT NULL,
|
|
-- The ID of the value
|
|
id serial PRIMARY KEY NOT NULL
|
|
);
|
|
|
|
-- Address for the requester
|
|
CREATE TABLE remote_addresses (
|
|
-- The IP address of the requester
|
|
addr inet UNIQUE NOT NULL,
|
|
-- The id of the address
|
|
id serial PRIMARY KEY NOT NULL
|
|
);
|
|
|
|
-- User agent strings
|
|
CREATE TABLE user_agents (
|
|
-- A User-Agent header value. Max length is the default maximum header size in nginx.
|
|
agent varchar(8192) NOT NULL,
|
|
-- The string's ID
|
|
id serial PRIMARY KEY NOT NULL
|
|
);
|
|
|
|
CREATE TABLE referrers (
|
|
-- A Referer header value. Max length is the default maximum header size in nginx.
|
|
referrer varchar(8192) NOT NULL,
|
|
-- The string's ID
|
|
id serial PRIMARY KEY NOT NULL
|
|
);
|
|
|
|
-- Requests
|
|
CREATE TABLE hits (
|
|
-- The size of the response payload
|
|
size integer NOT NULL,
|
|
-- Reference to a path id
|
|
path serial NOT NULL REFERENCES paths (id),
|
|
-- Reference to a remote host id
|
|
remote serial NOT NULL REFERENCES remote_addresses (id),
|
|
-- Reference to a host header id
|
|
host serial NOT NULL REFERENCES hosts (id),
|
|
-- Reference to a user agent
|
|
user_agent serial NOT NULL REFERENCES user_agents (id),
|
|
-- Reference to a referrer
|
|
referrer serial NOT NULL REFERENCES referrers (id),
|
|
-- Was the request served over HTTPS
|
|
secure boolean NOT NULL,
|
|
-- The time the request was made
|
|
time timestamp with time zone NOT NULL
|
|
);
|