cancel
Showing results forΒ 
Search instead forΒ 
Did you mean:Β 

How to drop db index from inherited itemType

Former Member
0 Kudos

Hi!

In H5.4 I'm trying to extend PriceRow and deploy it to new table:

 <itemtype code="PriceRowForOption" extends="PriceRow">

In PriceRow I have already defined one unique index. I want to drop this index in new type PriceRowForOption. But the attributes like:

 <index name="unique_listprice" unique="true" remove="true">

or

 <index name="unique_listprice" unique="true" replace="true">

does not work 😞

The old index is created in new table without any change. Any idea why?

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

I have an answer (workaround) for my self πŸ˜‰

The previous version of code:

 <itemtype code="PriceRow" autocreate="false" generate="false">
     (...)
     <indexes>
         <index name="unique_listprice" unique="true">
             <key attribute="field1"/>
             <key attribute="field2"/>
         </index>
     </indexes>
 </itemtype>

 <itemtype code="PriceRowForOption" extends="PriceRow" autocreate="true" generate="true">
     (...)
     <indexes>
         <index name="unique_listprice" unique="true">
             <key attribute="field1"/>
             <key attribute="field2"/>
             <key attribute="field3"/>
         </index>
     </indexes>
 </itemtype>

And the index unique_listprice was not replaced/updated in PriceRowForOption.

As a work around I've have now something like this:

 <itemtype code="PriceRow" autocreate="false" generate="false">
     (...)
     <!-- indexes element removed -->
 </itemtype>

 <itemtype code="CustomPriceRow" extends="PriceRow" autocreate="true" generate="true">
     (...)
     <indexes>
         <index name="unique_listprice" unique="true">
             <key attribute="field1"/>
             <key attribute="field2"/>
         </index>
     </indexes>
 </itemtype>

 <itemtype code="PriceRowForOption" extends="PriceRow" autocreate="true" generate="true">
     (...)
     <indexes>
         <index name="unique_listprice" unique="true">
             <key attribute="field1"/>
             <key attribute="field2"/>
             <key attribute="field3"/>
         </index>
     </indexes>
 </itemtype>

And now it works πŸ˜‰ I've extract the index to other item class. It's workaround, but the working one :)

Answers (2)

Answers (2)

Former Member
0 Kudos

I didn't explain my problem enough precise. I want to have this index in ProceRow, but I want to change/remove it from PriceRowForOption. But I need to define it in items.xml, otherwise inherited index from PriceRow will be recreated after every system update.

Former Member
0 Kudos

Hello!

Did you find a solution for this?

tylermac
Product and Topic Expert
Product and Topic Expert
0 Kudos

If you've removed the index from PriceRow and moved it to PriceRowForOption can you not just manually drop the index on PriceRow prior to running the system update that creates the index on PriceRowForOption?