diff options
-rw-r--r-- | sql/Pg-database.sql | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/sql/Pg-database.sql b/sql/Pg-database.sql index 5956879a..e783a946 100644 --- a/sql/Pg-database.sql +++ b/sql/Pg-database.sql @@ -56,9 +56,10 @@ COMMENT ON COLUMN country.itu IS $$ The ITU Telecommunication Standardization Se CREATE UNIQUE INDEX country_name_idx on country(lower(name)); CREATE TABLE location_class ( - id serial PRIMARY KEY, + id serial UNIQUE, class text check (class ~ '[[:alnum:]_]') not null, - authoritative boolean not null); + authoritative boolean not null, + PRIMARY KEY (class,authoritative)); CREATE UNIQUE INDEX lower_class_unique ON location_class(lower(class)); @@ -79,6 +80,8 @@ CREATE TABLE location ( country_id integer not null REFERENCES country(id), mail_code text not null check (mail_code ~ '[[:alnum:]_]')); +CREATE INDEX location_unique_class_idx ON location (id,location_class); + CREATE TABLE company ( id serial UNIQUE, entity_id integer not null references entity(id), |