Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0040933Openbravo ERPA. Platformpublic2019-05-22 10:222019-05-29 13:51
guillermogil 
AugustoMauch 
normalminoralways
closedfixed 
5
 
3.0PR19Q3 
caristu
Core
No
0040933: Export database changes Index order if a template removes it
If you have a template that removes an index it will be moved to a different position on the XML file and it will fail on the DBCons test.

- Create a template that removes EM_OBPOS_ORDER_DELIVERED index
- Put POSTerminal module in development
- Export database
- The following diff appears

diff -r 44ecec5ee66a src-db/database/model/modifiedTables/C_ORDER.xml
--- a/src-db/database/model/modifiedTables/C_ORDER.xml Tue May 21 19:01:42 2019 +0200
+++ b/src-db/database/model/modifiedTables/C_ORDER.xml Wed May 22 07:46:02 2019 +0000
@@ -65,9 +65,6 @@
       <index name="EM_OBPOS_DOCTYPE_IDX" unique="false">
         <index-column name="C_DOCTYPE_ID"/>
       </index>
- <index name="EM_OBPOS_ORDER_DELIVERED" unique="false">
- <index-column name="ISDELIVERED"/>
- </index>
       <index name="EM_OBPOS_ORDER_DOCNO_TRGM" unique="false" containsSearch="true">
         <index-column name="functionBasedColumn" functionExpression="UPPER(DOCUMENTNO)"/>
       </index>
@@ -78,6 +75,9 @@
         <index-column name="EM_OBPOS_REJECTED_QUOTAT_ID"/>
         <whereClause><![CDATA[EM_OBPOS_REJECTED_QUOTAT_ID IS NOT NULL]]></whereClause>
       </index>
+ <index name="EM_OBPOS_ORDER_DELIVERED" unique="false">
+ <index-column name="ISDELIVERED"/>
+ </index>
       <check name="EM_OBPOS_ISDELETED_CHECK"><![CDATA[EM_OBPOS_ISDELETED IN ('Y', 'N')]]></check>
       <check name="EM_OBPOS_ISLAYAWAY_CHK"><![CDATA[EM_OBPOS_ISLAYAWAY IN ('Y', 'N')]]></check>
     </table>
No tags attached.
related to feature request 0032211 closed caristu support for partial indexes 
Issue History
2019-05-22 10:22guillermogilNew Issue
2019-05-22 10:22guillermogilAssigned To => platform
2019-05-22 10:22guillermogilModules => Core
2019-05-22 10:22guillermogilTriggers an Emergency Pack => No
2019-05-22 18:06shuehnerIssue Monitored: shuehner
2019-05-27 11:48AugustoMauchReview Assigned To => caristu
2019-05-27 11:51hgbotCheckin
2019-05-27 11:51hgbotNote Added: 0112160
2019-05-27 11:51hgbotStatusnew => resolved
2019-05-27 11:51hgbotResolutionopen => fixed
2019-05-27 11:51hgbotFixed in SCM revision => http://code.openbravo.com/erp/devel/dbsm-main/rev/e770a97e88cf59a8d2ae3ac8f8a02fa1b5814c90 [^]
2019-05-27 11:51hgbotCheckin
2019-05-27 11:51hgbotNote Added: 0112161
2019-05-27 11:51hgbotFixed in SCM revisionhttp://code.openbravo.com/erp/devel/dbsm-main/rev/e770a97e88cf59a8d2ae3ac8f8a02fa1b5814c90 [^] => http://code.openbravo.com/erp/devel/pi/rev/a45b06d2479ee27970c45e3653cceb89098be2fb [^]
2019-05-27 17:38caristuRelationship addedrelated to 0032211
2019-05-27 17:47caristuAssigned Toplatform => AugustoMauch
2019-05-27 17:47caristuNote Added: 0112182
2019-05-27 17:47caristuStatusresolved => new
2019-05-27 17:47caristuResolutionfixed => open
2019-05-27 18:01hgbotCheckin
2019-05-27 18:01hgbotNote Added: 0112183
2019-05-27 18:01hgbotStatusnew => resolved
2019-05-27 18:01hgbotResolutionopen => fixed
2019-05-27 18:01hgbotFixed in SCM revisionhttp://code.openbravo.com/erp/devel/pi/rev/a45b06d2479ee27970c45e3653cceb89098be2fb [^] => http://code.openbravo.com/erp/devel/dbsm-main/rev/0c831934d9a77a4cfc4df1b0fa1800c4e203a7d0 [^]
2019-05-27 18:04AugustoMauchNote Added: 0112184
2019-05-27 21:02hudsonbotCheckin
2019-05-27 21:02hudsonbotNote Added: 0112186
2019-05-29 13:51caristuNote Added: 0112225
2019-05-29 13:51caristuStatusresolved => closed
2019-05-29 13:51caristuFixed in Version => 3.0PR19Q3

Notes
(0112160)
hgbot   
2019-05-27 11:51   
Repository: erp/devel/dbsm-main
Changeset: e770a97e88cf59a8d2ae3ac8f8a02fa1b5814c90
Author: Augusto Mauch <augusto.mauch <at> openbravo.com>
Date: Mon May 27 11:08:19 2019 +0200
URL: http://code.openbravo.com/erp/devel/dbsm-main/rev/e770a97e88cf59a8d2ae3ac8f8a02fa1b5814c90 [^]

Fixes issue 40933: Indexes are properly ordered when reversing a template

The problem was that when a template that removes an index is reversed, the index is added to the
end of the index list, instead of preserving the alphabetical order.

To fix it, just sort again indexes and constraints after reversing the templates.

---
M src/org/openbravo/ddlutils/util/DBSMOBUtil.java
---
(0112161)
hgbot   
2019-05-27 11:51   
Repository: erp/devel/pi
Changeset: a45b06d2479ee27970c45e3653cceb89098be2fb
Author: Augusto Mauch <augusto.mauch <at> openbravo.com>
Date: Mon May 27 11:48:56 2019 +0200
URL: http://code.openbravo.com/erp/devel/pi/rev/a45b06d2479ee27970c45e3653cceb89098be2fb [^]

Fixes issue 40933: Indexes are properly ordered when reversing a template

The problem was that when a template that removes an index is reversed, the index is added to the
end of the index list, instead of preserving the alphabetical order.

To fix it, just sort again indexes and constraints after reversing the templates.

---
M src-db/database/lib/dbsourcemanager.jar
---
(0112182)
caristu   
2019-05-27 17:47   
Reopened to check:

- Reordering should be done just once, when all the templates has been applied (outside the for loop)

- Is it the reordering operation expensive? Does it worth to check if any check/index removal has been applied by any template and just it that case apply the reordering?
(0112183)
hgbot   
2019-05-27 18:01   
Repository: erp/devel/dbsm-main
Changeset: 0c831934d9a77a4cfc4df1b0fa1800c4e203a7d0
Author: Augusto Mauch <augusto.mauch <at> openbravo.com>
Date: Mon May 27 17:59:29 2019 +0200
URL: http://code.openbravo.com/erp/devel/dbsm-main/rev/0c831934d9a77a4cfc4df1b0fa1800c4e203a7d0 [^]

Fixes issue 40933: Indexes and checks are sorted after reversing all templates

The previous changeset was reordering the table indexes and checks each time a template was reversed,
but it is enough to do it once, when all templates have been reversed.

---
M src/org/openbravo/ddlutils/util/DBSMOBUtil.java
---
(0112184)
AugustoMauch   
2019-05-27 18:04   
Reordering takes between 8-12 milliseconds. I think it is fast enough to do it always, instead of using a flag to keep track of when a template removed an index or a check constraint.
(0112186)
hudsonbot   
2019-05-27 21:02   
A changeset related to this issue has been promoted main and to the
Central Repository, after passing a series of tests.

Promotion changeset: https://code.openbravo.com/erp/devel/main/rev/51ab3e41a42a [^]
Maturity status: Test
(0112225)
caristu   
2019-05-29 13:51   
Reviewed