diff options
author | Rob Austein <sra@hactrn.net> | 2007-10-01 20:01:51 +0000 |
---|---|---|
committer | Rob Austein <sra@hactrn.net> | 2007-10-01 20:01:51 +0000 |
commit | dc31da6d5e3c663e384a058142b920e092730268 (patch) | |
tree | 916e24f80de5764d1d91ece4a7848df3716a596c | |
parent | cb5a335ab06aaa01e418ff37ea3d70efbceac985 (diff) |
Checkpoint
svn path=/docs/sample-irdb.sql; revision=1066
-rw-r--r-- | docs/sample-irdb.sql | 29 |
1 files changed, 7 insertions, 22 deletions
diff --git a/docs/sample-irdb.sql b/docs/sample-irdb.sql index f35b50fe..a039918a 100644 --- a/docs/sample-irdb.sql +++ b/docs/sample-irdb.sql @@ -7,7 +7,8 @@ CREATE TABLE asn ( start_as BIGINT unsigned NOT NULL, end_as BIGINT unsigned NOT NULL, resource_class_id BIGINT unsigned NOT NULL, - PRIMARY KEY (asn_id) + PRIMARY KEY (asn_id), + FOREIGN KEY (resource_class_id) REFERENCES resource_class ON DELETE SET NULL ON UPDATE SET NULL ); CREATE UNIQUE INDEX XPKasn ON asn @@ -23,7 +24,8 @@ CREATE TABLE net ( end_ip VARCHAR(40) NOT NULL, version TINYINT unsigned NOT NULL, resource_class_id BIGINT unsigned NOT NULL, - PRIMARY KEY (net_id) + PRIMARY KEY (net_id), + FOREIGN KEY (resource_class_id) REFERENCES resource_class ON DELETE SET NULL ON UPDATE SET NULL ); CREATE UNIQUE INDEX XPKnet ON net @@ -36,7 +38,7 @@ DROP TABLE IF EXISTS registrant; CREATE TABLE registrant ( registrant_id SERIAL NOT NULL, IRBE_mapped_id TEXT, - PRIMARY KEY (registrant_id) + PRIMARY KEY (registrant_id) ); CREATE UNIQUE INDEX XPKregistrant ON registrant @@ -51,28 +53,11 @@ CREATE TABLE resource_class ( subject_name TEXT, valid_until DATETIME NOT NULL, registrant_id BIGINT unsigned NOT NULL, - PRIMARY KEY (resource_class_id) + PRIMARY KEY (resource_class_id), + FOREIGN KEY (registrant_id) REFERENCES registrant ON DELETE SET NULL ON UPDATE SET NULL ); CREATE UNIQUE INDEX XPKresource_class ON resource_class ( resource_class_id ); - -ALTER TABLE asn - ADD FOREIGN KEY (resource_class_id) - REFERENCES resource_class - ON DELETE SET NULL - ON UPDATE SET NULL; - -ALTER TABLE net - ADD FOREIGN KEY (resource_class_id) - REFERENCES resource_class - ON DELETE SET NULL - ON UPDATE SET NULL; - -ALTER TABLE resource_class - ADD FOREIGN KEY (registrant_id) - REFERENCES registrant - ON DELETE SET NULL - ON UPDATE SET NULL; |