From 90fbcf4b369da709feb55fa0743925ec53e6019b Mon Sep 17 00:00:00 2001 From: linuxpoet Date: Tue, 22 May 2007 17:01:33 +0000 Subject: 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 --- sql/Pg-database.sql | 18 +++++++++++------- 1 file 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, -- cgit v1.2.3