Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0037592Openbravo ERPY. DBSourceManagerpublic2018-01-05 15:262018-03-02 16:52
neil_smith 
platform 
immediatecriticalalways
closedno change required 
5
3.0PR17Q2.4 
 
Core
No
0037592: update.database hangs if one module has a column in a table that's in another module not installed
Hello,

I just recently updated to 3.0MP17Q2.4

When I did the upgrade, everything went well (I went on a new instance and copied all the modules to the new instance).

Now, when I try to install a module update, I get the error (log extract pased at the end).


This is what I have

Module A, B and C

In some cases, I need module A, B and C. In some, only A and B.
Module A and B create columns in module C (C is dependent on A and B, but not A and B on C).
If I only have module A and B installed, I get the error.

This did not happen in the previous version we had installed (3.0PR16Q1.3).

I can't imagine having to create a module for each dependence between 2 modules... In my example, I would have to create 2 new modules, AC and BC... But that's not all, I also would have to change all the tables, windows, processes... Copy the data from the old column to the new one... Everything that uses those columns... And I have lot more than 3 modules...

I'm really stuck, I can't update or do anything now...



     [java] 110490 INFO - Running modulescripts...
     [java] 110621 INFO - Executing moduleScript: org.openbravo.modulescript.HBFix
     [java] 110849 INFO - Executing moduleScript: org.openbravo.modulescript.InitializeCostingMigrationPreference
     [java] 110916 INFO - Executing moduleScript: org.openbravo.advpaymentmngt.modulescript.InitializeAPRMReadyPreference
     [java] 110959 INFO - Updating Application Dictionary data...
     [java] 116275 ERROR - Error while inserting into the database: ERROR: insert or update on table "ad_column" violates foreign key constraint "ad_table_column"
     [java] Détail : Key (ad_table_id)=(8A8A80F63422305B0134225A5624004C) is not present in table "ad_table".
     [java] org.postgresql.util.PSQLException: ERROR: insert or update on table "ad_column" violates foreign key constraint "ad_table_column"
     [java] Détail : Key (ad_table_id)=(8A8A80F63422305B0134225A5624004C) is not present in table "ad_table".
1. Create 2 modules, A and B

2 In module A and B, create a table

3 In module A, create a column in the table in module B (EM_...)
Ignore column creation if table doesn't exist (as before)
No tags attached.
related to design defect 0034061 closed NaroaIriarte The cascade constraints deletion should be more restrictive 
Issue History
2018-01-05 15:26neil_smithNew Issue
2018-01-05 15:26neil_smithAssigned To => platform
2018-01-05 15:26neil_smithModules => Core
2018-01-05 15:26neil_smithTriggers an Emergency Pack => No
2018-01-19 12:07alostaleRelationship addedrelated to 0034061
2018-01-19 12:11alostaleNote Added: 0101782
2018-01-19 12:11alostaleStatusnew => closed
2018-01-19 12:11alostaleResolutionopen => no change required
2018-01-19 14:52neil_smithNote Added: 0101802
2018-03-02 16:52neil_smithNote Added: 0102941

Notes
(0101782)
alostale   
2018-01-19 12:11   
The problem is due to incorrect module definition. If module A and B use artifacts from C, they should depend on it and they cannot be installed without it.

Before fix 0034061 references from A and B were removed but the state was somehow inconsistent (ie. what you had in DB was not what A and B defined).
(0101802)
neil_smith   
2018-01-19 14:52   
Well it worked fine before... We developped things this way because it worked that way...

I can't make A and B dependent on C, that would mean that we have to install module C everywhere, and that wouldn't be correct.

How can I correct my modules? Do I have to create a module (AC) for these objects? But how do I call the columns in the table of module A that have to be added to the table in module C? EM_AC_COLUMN_NAME? Or can I simply call it C_COLUMN_NAME and define it as a table reference in the AD and set it's definition to point to the right table? To be honnest, none of these sound right to me...
And if I have to change the column name, I'm going to loose all the data in that column, and that is not concievable...

Is it not possible to make it work as before? Or at least for EM_ columns, if the destination table doesn't exist, don't create the column.

We will have to refactor everything and that represents 100s of hours of updating the database, the sources, testing everything...

Can you please help me with this, it has huge implications for us.

Thanks for your time
Best regards
Neil
(0102941)
neil_smith   
2018-03-02 16:52   
Thanks for your help...