diff options
author | Rob Austein <sra@hactrn.net> | 2007-09-25 17:57:33 +0000 |
---|---|---|
committer | Rob Austein <sra@hactrn.net> | 2007-09-25 17:57:33 +0000 |
commit | c63194c50e9f4d4b0f4b322f6ad565dd6d4a860c (patch) | |
tree | 889e0e570692680e63f1ac5f65ddc7487398681f /docs/sample-irdb.sql | |
parent | 4d5490ad9de2d794c6fb4cd65c15a20c312a6b29 (diff) |
Cleanup prior to hand-editing
svn path=/docs/rpki-db-schema.pdf; revision=1023
Diffstat (limited to 'docs/sample-irdb.sql')
-rw-r--r-- | docs/sample-irdb.sql | 154 |
1 files changed, 77 insertions, 77 deletions
diff --git a/docs/sample-irdb.sql b/docs/sample-irdb.sql index 083577d0..1efdea9b 100644 --- a/docs/sample-irdb.sql +++ b/docs/sample-irdb.sql @@ -1,77 +1,77 @@ -
-DROP TABLE IF EXISTS asn;
-
-CREATE TABLE asn (
- asn_id SERIAL NOT NULL,
- start_as BIGINT unsigned NOT NULL,
- end_as BIGINT unsigned NOT NULL,
- resource_class_id BIGINT unsigned NOT NULL,
- PRIMARY KEY (asn_id)
-);
-
-CREATE UNIQUE INDEX XPKasn ON asn
-(
- asn_id
-);
-
-DROP TABLE IF EXISTS net;
-
-CREATE TABLE net (
- net_id SERIAL NOT NULL,
- start_ip VARCHAR(40) NOT NULL,
- end_ip VARCHAR(40) NOT NULL,
- version TINYINT unsigned NOT NULL,
- resource_class_id BIGINT unsigned NOT NULL,
- PRIMARY KEY (net_id)
-);
-
-CREATE UNIQUE INDEX XPKnet ON net
-(
- net_id
-);
-
-DROP TABLE IF EXISTS registrant;
-
-CREATE TABLE registrant (
- registrant_id SERIAL NOT NULL,
- IRBE_mapped_id TEXT,
- PRIMARY KEY (registrant_id)
-);
-
-CREATE UNIQUE INDEX XPKregistrant ON registrant
-(
- registrant_id
-);
-
-DROP TABLE IF EXISTS resource_class;
-
-CREATE TABLE resource_class (
- resource_class_id SERIAL NOT NULL,
- subject_name TEXT,
- valid_until DATETIME NOT NULL,
- registrant_id BIGINT unsigned NOT NULL,
- PRIMARY KEY (resource_class_id)
-);
-
-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;
+ +DROP TABLE IF EXISTS asn; + +CREATE TABLE asn ( + asn_id SERIAL NOT NULL, + start_as BIGINT unsigned NOT NULL, + end_as BIGINT unsigned NOT NULL, + resource_class_id BIGINT unsigned NOT NULL, + PRIMARY KEY (asn_id) +); + +CREATE UNIQUE INDEX XPKasn ON asn +( + asn_id +); + +DROP TABLE IF EXISTS net; + +CREATE TABLE net ( + net_id SERIAL NOT NULL, + start_ip VARCHAR(40) NOT NULL, + end_ip VARCHAR(40) NOT NULL, + version TINYINT unsigned NOT NULL, + resource_class_id BIGINT unsigned NOT NULL, + PRIMARY KEY (net_id) +); + +CREATE UNIQUE INDEX XPKnet ON net +( + net_id +); + +DROP TABLE IF EXISTS registrant; + +CREATE TABLE registrant ( + registrant_id SERIAL NOT NULL, + IRBE_mapped_id TEXT, + PRIMARY KEY (registrant_id) +); + +CREATE UNIQUE INDEX XPKregistrant ON registrant +( + registrant_id +); + +DROP TABLE IF EXISTS resource_class; + +CREATE TABLE resource_class ( + resource_class_id SERIAL NOT NULL, + subject_name TEXT, + valid_until DATETIME NOT NULL, + registrant_id BIGINT unsigned NOT NULL, + PRIMARY KEY (resource_class_id) +); + +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; |