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

Re: Status of 1.4 and call for involvement



Chris Travers wrote:
I have committed your patches.  The one to pg-database.sql
thought seems out of date and already applied.  Are you running
last snapshot or from svn?


1) I still have the table creation order problem if I run prepare-company-database with the sql/Pg-database.sql from the repository. Only two tables actually end up being created after all the subsequent errors and rollbacks.

Can you actually run that script as is and successfully create a new company data base?


2) Also I noticed "sql/modules/Fixes.sql" tries to add a column to a table in which the column already exists.

Patches attached.


3) Also, please use a better commit message: "Fixing Berend Tober's bugs" sounds like someone else is repairing damage I caused. Something like "Applying patches from Berend" would be better.
Index: sql/Pg-database.sql
===================================================================
--- sql/Pg-database.sql	(revision 5194)
+++ 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,
Index: sql/modules/Fixes.sql
===================================================================
--- sql/modules/Fixes.sql	(revision 5194)
+++ sql/modules/Fixes.sql	(working copy)
@@ -4,14 +4,9 @@
 -- Chris Travers
 
 -- during 1.4m2
-BEGIN; 
 
 BEGIN;
-ALTER TABLE account ADD COLUMN is_temp BOOL NOT NULL DEFAULT FALSE;
-COMMIT;
 
-BEGIN;
-
 CREATE TABLE lsmb_group (
      role_name text primary key
 );