summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlinuxpoet <linuxpoet@4979c152-3d1c-0410-bac9-87ea11338e46>2007-05-22 17:01:33 +0000
committerlinuxpoet <linuxpoet@4979c152-3d1c-0410-bac9-87ea11338e46>2007-05-22 17:01:33 +0000
commit90fbcf4b369da709feb55fa0743925ec53e6019b (patch)
treec1aac2c0ab5fc366431abdb79291928c8795471c
parentf8ab8a2145dd0ca051d54a0ce2d83658fa9e5f24 (diff)
Created authoritative classes for entity_class
git-svn-id: https://ledger-smb.svn.sourceforge.net/svnroot/ledger-smb/trunk@1234 4979c152-3d1c-0410-bac9-87ea11338e46
-rw-r--r--sql/Pg-database.sql18
1 files changed, 11 insertions, 7 deletions
diff --git a/sql/Pg-database.sql b/sql/Pg-database.sql
index d3d66b9b..3657ac63 100644
--- a/sql/Pg-database.sql
+++ b/sql/Pg-database.sql
@@ -20,19 +20,23 @@ CREATE TABLE entity_class (
active boolean not null default TRUE);
COMMENT ON TABLE entity_class IS $$ Defines the class type such as vendor, customer, contact, employee $$;
-
+COMMENT ON COLUMN entity_class.id IS $$ The first 7 values are reserved and permanent $$;
+
CREATE UNIQUE index entity_class_unique_idx ON entity_class(lower(class));
COMMENT ON INDEX entity_class_unique_idx IS $$ Helps truly define unique. Which we could do that with Primary Keys $$;
ALTER TABLE entity ADD FOREIGN KEY (entity_class) REFERENCES entity_class(id);
-INSERT INTO entity_class (class) VALUES ('Vendor');
-INSERT INTO entity_class (class) VALUES ('Customer');
-INSERT INTO entity_class (class) VALUES ('Employee');
-INSERT INTO entity_class (class) VALUES ('Contact');
-INSERT INTO entity_class (class) VALUES ('Lead');
-INSERT INTO entity_class (class) VALUES ('Referral');
+INSERT INTO entity_class (id,class) VALUES (1,'Vendor');
+INSERT INTO entity_class (id,class) VALUES (2,'Customer');
+INSERT INTO entity_class (id,class) VALUES (3,'Employee');
+INSERT INTO entity_class (id,class) VALUES (4,'Contact');
+INSERT INTO entity_class (id,class) VALUES (5,'Lead');
+INSERT INTO entity_class (id,class) VALUES (6,'Referral');
+
+SELECT setval('entity_class_id_seq',7);
+
CREATE TABLE country (
id serial PRIMARY KEY,