From: Thierry Parmentelat Date: Thu, 1 Dec 2011 17:45:35 +0000 (+0100) Subject: rename table 'sfa' into 'records' and add constraints on types X-Git-Tag: sfa-2.0-2~27 X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=32c1a6cb09379857184bc15d1ff3fe5b914fe9d2;p=sfa.git rename table 'sfa' into 'records' and add constraints on types --- diff --git a/sfa/storage/sfa.sql b/sfa/storage/sfa.sql index 3d7984d1..202b91fb 100644 --- a/sfa/storage/sfa.sql +++ b/sfa/storage/sfa.sql @@ -36,14 +36,27 @@ CREATE AGGREGATE array_accum ( initcond = '{}' ); +-- Valid record types +CREATE TABLE record_types ( + record_type text PRIMARY KEY +) WITH OIDS; +INSERT INTO record_types (record_type) VALUES ('authority'); +INSERT INTO record_types (record_type) VALUES ('authority+sa'); +INSERT INTO record_types (record_type) VALUES ('authority+am'); +INSERT INTO record_types (record_type) VALUES ('authority+sm'); +INSERT INTO record_types (record_type) VALUES ('user'); +INSERT INTO record_types (record_type) VALUES ('slice'); +INSERT INTO record_types (record_type) VALUES ('node'); + + -- main table -CREATE TABLE sfa ( +CREATE TABLE records ( record_id serial PRIMARY KEY , hrn text NOT NULL, authority text NOT NULL, peer_authority text, gid text, - type text NOT NULL, + type text REFERENCES record_types, pointer integer, date_created timestamp without time zone NOT NULL DEFAULT CURRENT_TIMESTAMP, last_updated timestamp without time zone NOT NULL DEFAULT CURRENT_TIMESTAMP diff --git a/sfa/storage/table.py b/sfa/storage/table.py index acd0b3d9..602bcabe 100644 --- a/sfa/storage/table.py +++ b/sfa/storage/table.py @@ -14,7 +14,7 @@ from sfa.storage.record import SfaRecord, AuthorityRecord, NodeRecord, SliceReco class SfaTable(list): - SFA_TABLE_PREFIX = "sfa" + SFA_TABLE_PREFIX = "records" def __init__(self, record_filter = None):