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

Re: Status of 1.4 and call for involvement



Chris Travers wrote:
1.4 is coming along.  We could use more involvement.  ...
Anyone who would like help getting started should email this list.

You can get the latest by svn co
https://ledger-smb.svn.sourceforge.net/svnroot/ledger-smb/trunk

I have svn updated my check out of trunk.

I get a number of errors running prepare-company-database.sh.

The first two appear due to a table creation ordering problem.

The tables "business_unit_class" and "business_unit" are referenced as foreign keys before they are created.

Attached patch changes creates those two tables earlier.

There are still a bunch of errors I am getting, though, after the sql/modules start to load.

Index: sql/Pg-database.sql
===================================================================
--- sql/Pg-database.sql	(revision 5185)
+++ sql/Pg-database.sql	(working copy)
@@ -1231,6 +1231,39 @@
     primary key (id)
 );
 
+CREATE TABLE business_unit_class (
+    id serial not null unique,
+    label text primary key,
+    active bool not null default false,
+    ordering int
+);
+
+COMMENT ON TABLE business_unit_class IS 
+$$ Consolidates projects and departments, and allows this to be extended for
+funds accounting and other purposes.$$;
+
+INSERT INTO business_unit_class (id, label, active, ordering)
+VALUES (1, 'Department', '0', '10'),
+       (2, 'Project', '0', '20'),
+       (3, 'Job', '0', '30'),
+       (4, 'Fund', '0', '40'),
+       (5, 'Customer', '0', '50'),
+       (6, 'Vendor', '0', '60'),
+       (7, 'Lot',  '0', 50);
+
+CREATE TABLE business_unit (
+  id serial PRIMARY KEY,
+  class_id int not null references business_unit_class(id),
+  control_code text,
+  description text,
+  start_date date,
+  end_date date,
+  parent_id int references business_unit(id),
+  credit_id int references entity_credit_account(id),
+  UNIQUE(id, class_id), -- needed for foreign keys
+  UNIQUE(class_id, control_code) 
+);
+
 CREATE TABLE business_unit_jl (
     entry_id int references journal_line(id),
     bu_class int references business_unit_class(id),
@@ -1925,26 +1958,6 @@
 you have to spend to acquire the foreign currency (buy rate).$$;
 --
 
-CREATE TABLE business_unit_class (
-    id serial not null unique,
-    label text primary key,
-    active bool not null default false,
-    ordering int
-);
-
-COMMENT ON TABLE business_unit_class IS 
-$$ Consolidates projects and departments, and allows this to be extended for
-funds accounting and other purposes.$$;
-
-INSERT INTO business_unit_class (id, label, active, ordering)
-VALUES (1, 'Department', '0', '10'),
-       (2, 'Project', '0', '20'),
-       (3, 'Job', '0', '30'),
-       (4, 'Fund', '0', '40'),
-       (5, 'Customer', '0', '50'),
-       (6, 'Vendor', '0', '60'),
-       (7, 'Lot',  '0', 50);
-
 CREATE TABLE bu_class_to_module (
    bu_class_id int references business_unit_class(id),
    module_id int references lsmb_module(id),
@@ -1958,19 +1971,6 @@
   JOIN lsmb_module; -- by default activate all existing business units on all modules
        
 
-CREATE TABLE business_unit (
-  id serial PRIMARY KEY,
-  class_id int not null references business_unit_class(id),
-  control_code text,
-  description text,
-  start_date date,
-  end_date date,
-  parent_id int references business_unit(id),
-  credit_id int references entity_credit_account(id),
-  UNIQUE(id, class_id), -- needed for foreign keys
-  UNIQUE(class_id, control_code) 
-);
-
 CREATE TABLE job (
   bu_id int primary key references business_unit(id),
   parts_id int,