summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sql/Pg-database.sql4
1 files changed, 3 insertions, 1 deletions
diff --git a/sql/Pg-database.sql b/sql/Pg-database.sql
index b28c41e7..904dfb27 100644
--- a/sql/Pg-database.sql
+++ b/sql/Pg-database.sql
@@ -9,8 +9,10 @@ CREATE TABLE transactions (
CREATE TABLE entity (
id serial PRIMARY KEY,
name text check (name ~ '[[:alnum:]_]'),
- entity_class integer not null UNIQUE,
+ entity_class integer not null,
created date not null default current_date);
+
+CREATE UNIQUE INDEX entity_class_name_class_idx ON entity(name,entity_class);
COMMENT ON TABLE entity IS $$ The primary entity table to map to all contacts $$;
COMMENT ON COLUMN entity.name IS $$ This is the common name of an entity. If it was a person it may be Joshua Drake, a company Acme Corp. You may also choose to use a domain such as commandprompt.com $$;