Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0043790Openbravo ERP00. Application dictionarypublic2020-04-20 13:412022-02-01 07:24
shuehner 
Triage Platform Base 
normalminorhave not tried
newopen 
5
 
 
Core
No
0043790: Not possible to uninstall a module having grid config for a contained tab or field defined
If a grid config for a tab or field contained in a module exists in the database it is not possible to uninstall that module.

Problem are the 2 foreign-keys:
- obuiapp_gc_tab -> ad_tab
- obuiapp_gc_field -> ad_field

Which are not declared with onDeleteCascade.

For this use-case when deleting a module any custom grid-config should be probably delete as well instead of breaking the module-uninstall (current behavior).

Error is like this using steps below:
     [java] 30490 [main] INFO org.apache.ddlutils.platform.PGStandardBatchEvaluator - Batch statement failed. Rolling back and retrying all the statements in a non-batched connection.
     [java] 30923 [main] WARN org.apache.ddlutils.platform.PGStandardBatchEvaluator - SQL Command failed with: ERROR: insert or update on table "obuiapp_gc_field" violates foreign key constraint "obuiapp_gc_field_field"
     [java] Detail: Key (ad_field_id)=(0787AC0FCA6742AE91D991D2DF849052) is not present in table "ad_field".
     [java] 30924 [main] WARN org.apache.ddlutils.platform.PGStandardBatchEvaluator - -- END
     [java] ALTER TABLE OBUIAPP_GC_FIELD
     [java] ADD CONSTRAINT OBUIAPP_GC_FIELD_FIELD FOREIGN KEY (AD_FIELD_ID) REFERENCES AD_FIELD (AD_FIELD_ID)
     [java] 30927 [main] WARN org.apache.ddlutils.platform.PGStandardBatchEvaluator - SQL Command failed with: ERROR: insert or update on table "obuiapp_gc_tab" violates foreign key constraint "obuiapp_gc_tab_tab"
     [java] Detail: Key (ad_tab_id)=(14BDEAB664C146DCB662B2E3EA7A495E) is not present in table "ad_tab".
     [java] 30928 [main] WARN org.apache.ddlutils.platform.PGStandardBatchEvaluator - -- END
     [java] ALTER TABLE OBUIAPP_GC_TAB
     [java] ADD CONSTRAINT OBUIAPP_GC_TAB_TAB FOREIGN KEY (AD_TAB_ID) REFERENCES AD_TAB (AD_TAB_ID)

Indirectly noticed with:
fresh pi with 2 modules on top
https://code.openbravo.com/erp/pmods/org.openbravo.warehouse.advancedwarehouseoperations [^]
https://code.openbravo.com/erp/pmods/org.openbravo.mobile.core [^]

ant run.all.tests
That contains tests creating grid config apparently and leaving them present after the test

Delete the 2 modules cloned above
run update.database

Error about those 2 foreign keys here having non-compliant data is shown.

No tags attached.
Issue History
2020-04-20 13:41shuehnerNew Issue
2020-04-20 13:41shuehnerAssigned To => platform
2020-04-20 13:41shuehnerModules => Core
2020-04-20 13:41shuehnerTriggers an Emergency Pack => No
2022-02-01 07:24alostaleAssigned Toplatform => Triage Platform Base

There are no notes attached to this issue.