[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

SF.net SVN: ledger-smb: [1455] trunk/sql/Pg-database.sql



Revision: 1455
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=1455&view=rev
Author:   linuxpoet
Date:     2007-08-09 13:08:36 -0700 (Thu, 09 Aug 2007)

Log Message:
-----------
fixed primary key for entity

Modified Paths:
--------------
    trunk/sql/Pg-database.sql

Modified: trunk/sql/Pg-database.sql
===================================================================
--- trunk/sql/Pg-database.sql	2007-08-06 20:28:31 UTC (rev 1454)
+++ trunk/sql/Pg-database.sql	2007-08-09 20:08:36 UTC (rev 1455)
@@ -112,13 +112,12 @@
 
 -- 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 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   
 
 --


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.