cancel
Showing results for 
Search instead for 
Did you mean: 

Removing a unique index?

alexswalker
Discoverer
0 Kudos

We are attempting to upgrade our CCV2 version from 2105 to 2205 and are having issues with new indexes added to the WCMS items here https://help.sap.com/docs/SAP_COMMERCE/a74589c3a81a4a95bf51d87258c0ab15/8bd2bb5030744a2d8c1f28a7b931...

The update process is trying to create this index:

CREATE UNIQUE INDEX cmsRelationByUidCvIdx_99 ON genericitems (p_uid, p_catalogversion);

error code [1505]; The CREATE UNIQUE INDEX statement terminated because a duplicate key was found for the object name 'dbo.genericitems' and the index name 'cmsRelationByUidCvIdx_99'. The duplicate key value is (<NULL>, <NULL>).;

As our initial version of Hybris started on 4.5 the "CMSRelation" item type did not have it's own deployment table, so it has duplicate data in the genericitems table.

We have a few options, one of them being exporting the data, deleting the type and recreating, and then re-importing the data OR just ignore these indexes. First option seems a lot of effort.

Is it possible to override these indexes and set unique = false? Or use this to prevent them being created?:

bootstrap.init.type.system.custom.index.ignore.names.starting.with

Thanks a lot

Accepted Solutions (1)

Accepted Solutions (1)

mansurarisoy
Contributor
0 Kudos

You can change the uniqueness of the index by defining the following definition in one of your custom extension's (which requires cms2 extension) items.xml file

<itemtype code="CMSRelation" autocreate="false" generate="false">
    <indexes>
        <index name="cmsRelationByUidCvIdx" replace="true" unique="false">
            <key attribute="uid"/>
            <key attribute="catalogVersion"/>
        </index>
    </indexes>
</itemtype><br>

But my suggestion would be to go with the first option: migrating data to correct table.

alexswalker
Discoverer
0 Kudos

Thank you, this option worked. There is too much data in our genericitems table and I didn't want to risk migrating all this.

Answers (1)

Answers (1)

safin
Advisor
Advisor
0 Kudos

Hi Alex,

As far as i know, currently there are no requirements to directly use CMSRelation instances in SAP Commerce, instead, it should be ContentSlotForPage and ContentSlotForPage instances to be used (both ContentSlotForPage and ContentSlotForPage are just subtype of CMSRelation), please check your system to make sure whether or not you still need any instances for CMSRelation, if there is no need to use any CMSRelation instances, the best way is to remove all of them from your DB.

Of course, all of these three solutions you come up with can work.