From 6fb2b8d80595bde410e71deab19474596287eba4 Mon Sep 17 00:00:00 2001 From: linuxpoet Date: Mon, 4 Jun 2007 22:58:22 +0000 Subject: added constraint to id,location_class git-svn-id: https://ledger-smb.svn.sourceforge.net/svnroot/ledger-smb/trunk@1254 4979c152-3d1c-0410-bac9-87ea11338e46 --- sql/Pg-database.sql | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'sql') 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), -- cgit v1.2.3