diff options
author | linuxpoet <linuxpoet@4979c152-3d1c-0410-bac9-87ea11338e46> | 2007-06-04 22:58:22 +0000 |
---|---|---|
committer | linuxpoet <linuxpoet@4979c152-3d1c-0410-bac9-87ea11338e46> | 2007-06-04 22:58:22 +0000 |
commit | 6fb2b8d80595bde410e71deab19474596287eba4 (patch) | |
tree | d12b75811b77c394ee1f36f5e437ba98788cf6e6 /sql | |
parent | 6b758978f4eaad8227a5222e64ab17157697466b (diff) |
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
Diffstat (limited to 'sql')
-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), |