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

SF.net SVN: ledger-smb:[3252] trunk/sql



Revision: 3252
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=3252&view=rev
Author:   einhverfr
Date:     2011-06-15 12:52:42 +0000 (Wed, 15 Jun 2011)

Log Message:
-----------
A couple of unique indexes needed for integrity of data

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

Added Paths:
-----------
    trunk/sql/upgrade/3252-uniques.sql

Modified: trunk/sql/Pg-database.sql
===================================================================
--- trunk/sql/Pg-database.sql	2011-06-15 11:54:40 UTC (rev 3251)
+++ trunk/sql/Pg-database.sql	2011-06-15 12:52:42 UTC (rev 3252)
@@ -543,7 +543,8 @@
     first_name text check (first_name ~ '[[:alnum:]_]') NOT NULL,
     middle_name text,
     last_name text check (last_name ~ '[[:alnum:]_]') NOT NULL,
-    created date not null default current_date
+    created date not null default current_date,
+    unique(entity_id) -- needed due to entity_emplyee assumptions --CT
  );
  
 COMMENT ON TABLE person IS $$ Every person, must have an entity to derive a common or display name. The correct way to get class information on a person would be person.entity_id->entity_class_to_entity.entity_id. $$;
@@ -1081,7 +1082,8 @@
   approved bool default true,
   entity_credit_account int references entity_credit_account(id) not null,
   force_closed bool,
-  description text
+  description text,
+  unique(invnumber) -- probably a good idea as per Erik's request --CT
 );
 
 COMMENT ON COLUMN ar.entity_id IS $$ Used to be customer_id, but customer is now metadata. You need to push to entity $$;

Added: trunk/sql/upgrade/3252-uniques.sql
===================================================================
--- trunk/sql/upgrade/3252-uniques.sql	                        (rev 0)
+++ trunk/sql/upgrade/3252-uniques.sql	2011-06-15 12:52:42 UTC (rev 3252)
@@ -0,0 +1,2 @@
+ALTER TABLE ar ADD unique(invnumber);
+ALTER TABLE person ADD UNIQUE (entity_id);


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