CREATE TABLE IF NOT EXISTS proactive (
	id             INTEGER PRIMARY KEY,
	timestamp      INTEGER NOT NULL,
	ip             TEXT,
	ip_int         INTEGER,
	ip_version     INTEGER,
	ip_country_id  VARCHAR(255),
	rule_name      TEXT NOT NULL,
	description    TEXT,
	action         TEXT NOT NULL,
	host           TEXT,
	path           TEXT NOT NULL,
	url            TEXT,
	count          INTEGER NOT NULL,
	uid            INTEGER NOT NULL,
	gid            INTEGER NOT NULL,
	rule_id        INTEGER
);

CREATE TABLE IF NOT EXISTS proactive_env (
	event_id INTEGER NOT NULL,
	name     TEXT NOT NULL,
	value    TEXT,
	PRIMARY KEY (event_id, name, value)
	FOREIGN KEY(event_id) REFERENCES proactive(id) ON DELETE CASCADE
);