summaryrefslogtreecommitdiff
path: root/sql/Pg-database.sql
diff options
context:
space:
mode:
authorlinuxpoet <linuxpoet@4979c152-3d1c-0410-bac9-87ea11338e46>2007-08-09 20:08:36 +0000
committerlinuxpoet <linuxpoet@4979c152-3d1c-0410-bac9-87ea11338e46>2007-08-09 20:08:36 +0000
commit705cd6e99995e16036e606cb81ee729f8279a80d (patch)
tree9af91aefaf9c13c2d0826aadf763df660768dec5 /sql/Pg-database.sql
parentf1756b69854a21b50da387f32f394d4b6fb80be7 (diff)
fixed primary key for entity
git-svn-id: https://ledger-smb.svn.sourceforge.net/svnroot/ledger-smb/trunk@1455 4979c152-3d1c-0410-bac9-87ea11338e46
Diffstat (limited to 'sql/Pg-database.sql')
-rw-r--r--sql/Pg-database.sql11
1 files changed, 3 insertions, 8 deletions
diff --git a/sql/Pg-database.sql b/sql/Pg-database.sql
index 8011a9b8..57594e4a 100644
--- a/sql/Pg-database.sql
+++ b/sql/Pg-database.sql
@@ -112,13 +112,12 @@ batch work flows. $$;
-- BEGIN new entity management
CREATE TABLE entity (
- id serial PRIMARY KEY,
+ id serial UNIQUE,
name text check (name ~ '[[:alnum:]_]'),
entity_class integer not null,
- created date not null default current_date);
+ created date not null default current_date,
+ PRIMARY KEY(name,entity_class));
-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 $$;
@@ -323,10 +322,6 @@ CREATE INDEX invoice_note_id_idx ON invoice_note(id);
CREATE UNIQUE INDEX invoice_note_class_idx ON note_class(lower(class));
CREATE INDEX invoice_note_vectors_idx ON invoice_note USING gist(vector);
--- is this safe?
-ALTER TABLE invoice_note ADD CHECK (id = 2);
-
-
-- END entity
--