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

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



Revision: 6078
          http://sourceforge.net/p/ledger-smb/code/6078
Author:   einhverfr
Date:     2013-09-25 11:00:00 +0000 (Wed, 25 Sep 2013)
Log Message:
-----------
Fixes for 1.3-1.4 upgrade.
Note that this also fixes a problem with recurring transactions not working in 1.4

Modified Paths:
--------------
    trunk/sql/Pg-database.sql
    trunk/sql/upgrade/1.3-1.4.sql

Modified: trunk/sql/Pg-database.sql
===================================================================
--- trunk/sql/Pg-database.sql	2013-09-24 07:43:31 UTC (rev 6077)
+++ trunk/sql/Pg-database.sql	2013-09-25 11:00:00 UTC (rev 6078)
@@ -2223,7 +2223,7 @@
 $$ This table sets the basic preferences for formats, languages, printers, and user-selected stylesheets.$$;
 
 CREATE TABLE recurring (
-  id int references journal_entry(id) unique,
+  id int not null references transactions(id) unique,
   reference text,
   startdate date,
   nextdate date,

Modified: trunk/sql/upgrade/1.3-1.4.sql
===================================================================
--- trunk/sql/upgrade/1.3-1.4.sql	2013-09-24 07:43:31 UTC (rev 6077)
+++ trunk/sql/upgrade/1.3-1.4.sql	2013-09-25 11:00:00 UTC (rev 6078)
@@ -10,7 +10,8 @@
 
 --to preserve user modifications tshvr4
 DELETE FROM country;
-INSERT INTO country SELECT * FROM lsmb13.country;
+INSERT INTO country (id, name, short_name, itu) 
+SELECT id, name, short_name, itu FROM lsmb13.country;
 
 INSERT INTO language SELECT * FROM lsmb13.language where code not in (select code from language);
 
@@ -85,7 +86,11 @@
  FROM lsmb13.parts p;
 
 INSERT INTO country_tax_form SELECT * FROM lsmb13.country_tax_form;
-INSERT INTO entity SELECT * FROM lsmb13.entity;
+
+INSERT INTO entity (id, name, entity_class, control_code, created, country_id) 
+SELECT id, name, entity_class, control_code, created, country_id 
+  FROM lsmb13.entity;
+
 INSERT INTO users SELECT * FROM lsmb13.users;
 INSERT INTO lsmb_roles SELECT * FROM lsmb13.lsmb_roles;
 INSERT INTO location SELECT * FROM lsmb13.location;
@@ -117,7 +122,8 @@
    FROM lsmb13.person_to_contact pc
    JOIN lsmb13.person p ON p.id = pc.person_id
    JOIN lsmb13.entity e ON e.id = p.entity_id;
-INSERT INTO entity_bank_account SELECT * FROM lsmb13.entity_bank_account;
+INSERT INTO entity_bank_account (id, entity_id, bic, iban)
+SELECT id, entity_id, bic, iban FROM lsmb13.entity_bank_account;
 INSERT INTO entity_credit_account SELECT * FROM lsmb13.entity_credit_account;
 INSERT INTO eca_to_contact SELECT * FROM lsmb13.eca_to_contact;
 INSERT INTO eca_to_location SELECT * FROM lsmb13.eca_to_location;
@@ -475,7 +481,7 @@
 
 INSERT INTO business_unit_ac (entry_id, class_id, bu_id)
 SELECT entry_id, 2, project_id + 1000 FROM lsmb13.acc_trans
- WHERE project_id > 0;
+ WHERE project_id > 0 and project_id in (select id from lsmb13.project);
 
 INSERT INTO business_unit_inv (entry_id, class_id, bu_id)
 SELECT inv.id, 1, gl.department_id
@@ -487,7 +493,7 @@
 
 INSERT INTO business_unit_inv (entry_id, class_id, bu_id)
 SELECT id, 2, project_id + 1000 FROM lsmb13.invoice 
- WHERE project_id > 0;
+ WHERE project_id > 0 and  project_id in (select id from lsmb13.project);
 
 INSERT INTO business_unit_oitem (entry_id, class_id, bu_id)
 SELECT oi.id, 1, oe.department_id 
@@ -496,7 +502,7 @@
 
 INSERT INTO business_unit_oitem (entry_id, class_id, bu_id)
 SELECT id, 2, project_id + 1000 FROM lsmb13.orderitems
- WHERE project_id > 0;
+ WHERE project_id > 0  and  project_id in (select id from lsmb13.project);
 
 INSERT INTO partsgroup SELECT * FROM lsmb13.partsgroup;
 INSERT INTO status SELECT * FROM lsmb13.status;
@@ -554,7 +560,8 @@
  1,
   (SELECT (string_to_array(value, ':'))[1] 
      FROM lsmb13.defaults WHERE setting_key = 'curr')
-  FROM lsmb13.jcitems;
+  FROM lsmb13.jcitems
+ WHERE project_id IN (select id from lsmb13.project);
 INSERT INTO custom_table_catalog SELECT * FROM lsmb13.custom_table_catalog;
 INSERT INTO custom_field_catalog SELECT * FROM lsmb13.custom_field_catalog;
 INSERT INTO ac_tax_form SELECT * FROM lsmb13.ac_tax_form;

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


------------------------------------------------------------------------------
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from 
the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60133471&iu=/4140/ostg.clktrk
_______________________________________________
Ledger-smb-commits mailing list
..hidden..
https://lists.sourceforge.net/lists/listinfo/ledger-smb-commits