Skip to content

Commit

Permalink
o Add "requests" table
Browse files Browse the repository at this point in the history
o Add IF NOT EXISTS clause to all CREATE TABLE commands
  • Loading branch information
Murray S. Kucherawy committed May 13, 2012
1 parent ea756bb commit 87ed518
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions db/schema.mysql
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
-- All rights reserved.

-- A table for mapping domain names to IDs
CREATE TABLE domains (
CREATE TABLE IF NOT EXISTS domains (
id INT NOT NULL AUTO_INCREMENT,
name VARCHAR(255) NOT NULL,
firstseen TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
Expand All @@ -15,7 +15,7 @@ CREATE TABLE domains (
);

-- A table for reporting hosts
CREATE TABLE reporters (
CREATE TABLE IF NOT EXISTS reporters (
id INT NOT NULL AUTO_INCREMENT,
name VARCHAR(255) NOT NULL,
firstseen TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
Expand All @@ -25,7 +25,7 @@ CREATE TABLE reporters (
);

-- A table for IP addresses
CREATE TABLE ipaddr (
CREATE TABLE IF NOT EXISTS ipaddr (
id INT NOT NULL AUTO_INCREMENT,
addr VARCHAR(64) NOT NULL,
firstseen TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
Expand All @@ -35,7 +35,7 @@ CREATE TABLE ipaddr (
);

-- A table for messages
CREATE TABLE messages (
CREATE TABLE IF NOT EXISTS messages (
id INT NOT NULL AUTO_INCREMENT,
date TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
jobid VARCHAR(128) NOT NULL,
Expand All @@ -52,7 +52,7 @@ CREATE TABLE messages (
);

-- A table for signatures
CREATE TABLE signatures (
CREATE TABLE IF NOT EXISTS signatures (
id INT NOT NULL AUTO_INCREMENT,
message INT NOT NULL,
domain INT NOT NULL,
Expand All @@ -62,3 +62,13 @@ CREATE TABLE signatures (

PRIMARY KEY(id)
);

-- A table for DMARC requests
CREATE TABLE IF NOT EXISTS requests (
id INT NOT NULL AUTO_INCREMENT,
domain INT NOT NULL,
repaddr VARCHAR(255) NOT NULL,
lastsent TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00',

PRIMARY KEY(id)
);

0 comments on commit 87ed518

Please sign in to comment.