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

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



Revision: 2747
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=2747&view=rev
Author:   einhverfr
Date:     2009-08-07 15:41:03 +0000 (Fri, 07 Aug 2009)

Log Message:
-----------
All tests now work on new installations and with current db constraints

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

Modified: trunk/sql/Pg-database.sql
===================================================================
--- trunk/sql/Pg-database.sql	2009-08-07 06:04:22 UTC (rev 2746)
+++ trunk/sql/Pg-database.sql	2009-08-07 15:41:03 UTC (rev 2747)
@@ -632,7 +632,8 @@
     cash_account_id int references account(id),
     bank_account int references entity_bank_account(id),
     taxform_id int references country_tax_form(id),
-    PRIMARY KEY(entity_id, meta_number, entity_class)
+    PRIMARY KEY(entity_id, meta_number, entity_class),
+    CHECK (ar_ap_account_id IS NOT NULL OR entity_id = 0)
 );
 
 CREATE UNIQUE INDEX entity_credit_ar_accno_idx_u 
@@ -658,7 +659,7 @@
   location_class integer not null references location_class(id),
   credit_id integer not null references entity_credit_account(id) 
 	ON DELETE CASCADE,
-  PRIMARY KEY(location_id,credit_id));
+  PRIMARY KEY(location_id,credit_id, location_class));
 
 CREATE UNIQUE INDEX eca_to_location_billing_u ON eca_to_location(credit_id)
 	WHERE location_class = 1;
@@ -861,18 +862,18 @@
 --
 
 -- THe following credit accounts are used for inventory adjustments.
-INSERT INTO entity (name, entity_class, control_code,country_id) 
-values ('Inventory Entity', 1, 'AUTO-01','232');
+INSERT INTO entity (id, name, entity_class, control_code,country_id) 
+values (0, 'Inventory Entity', 1, 'AUTO-01','232');
 
 INSERT INTO company (legal_name, entity_id) 
-values ('Inventory Entity', currval('entity_id_seq'));
+values ('Inventory Entity', 0);
 
 INSERT INTO entity_credit_account (entity_id, meta_number, entity_class)
 VALUES 
-(currval('entity_id_seq'), '00000', 1);
+(0, '00000', 1);
 INSERT INTO entity_credit_account (entity_id, meta_number, entity_class)
 VALUES 
-(currval('entity_id_seq'), '00000', 2);
+(0, '00000', 2);
 
 
 -- notes are from entity_note

Modified: trunk/sql/modules/Reconciliation.sql
===================================================================
--- trunk/sql/modules/Reconciliation.sql	2009-08-07 06:04:22 UTC (rev 2746)
+++ trunk/sql/modules/Reconciliation.sql	2009-08-07 15:41:03 UTC (rev 2747)
@@ -37,7 +37,6 @@
     voucher_id int REFERENCES voucher(id),
     overlook boolean not null default 'f',
     cleared boolean not null default 'f',
-    check (ledger_id is not null or voucher_id is not null)
 );
 
 CREATE TABLE cr_coa_to_account (


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