> For the complete documentation index, see [llms.txt](https://dev.ucommerce.net/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://dev.ucommerce.net/readme/how-to/migrate-from-classic/common-database-issues.md).

# Common database issues

## 10.9.0: Duplicate definition field names on definitions

When migrating to Ucommerce Next Gen >10.9.0, you might encounter the following error:

{% code overflow="wrap" %}

```
Ucommerce database migration failed with message The CREATE UNIQUE INDEX statement terminated because a duplicate key was found for the object name 'dbo.uCommerce_DefinitionField' and the index name 'UX_uCommerce_DefinitionField_DefinitionId_Name'. The duplicate key value is (1, Organization). The statement has been terminated., in script 117 - Create missing unique indexes on definition fields
```

{% endcode %}

This means that you have multiple definition fields with the same name for the same definition. This makes the data ambiguous and should be avoided. Unfortunately, we cannot know what data is correct and apply automatic corrections. Instead, what you have to do is clean up the database manually before proceeding with the migration.

Fortunately we have made this task easy for you. To find the duplicates that needs to be cleaned up, run the following scripts:

{% code title="Product definitions" overflow="wrap" %}

```sql
SELECT pdf.* FROM uCommerce_ProductDefinitionField as pdf 
INNER JOIN ( 
    SELECT [ProductDefinitionId], [Name] 
    FROM [uCommerce_ProductDefinitionField] 
    GROUP BY ProductDefinitionId, Name 
    HAVING COUNT(*) > 1 
) AS Duplicates ON pdf.ProductDefinitionId = Duplicates.ProductDefinitionId AND pdf.Name = Duplicates.Name
ORDER BY Name, ProductDefinitionId
```

{% endcode %}

{% code title="Other definitions" overflow="wrap" %}

```sql
SELECT df.* FROM uCommerce_DefinitionField as df 
INNER JOIN ( 
    SELECT [DefinitionId], [Name] 
    FROM [uCommerce_DefinitionField] 
    GROUP BY DefinitionId, Name 
    HAVING COUNT(*) > 1 
) AS Duplicates ON df.DefinitionId = Duplicates.DefinitionId AND df.Name = Duplicates.Name
ORDER BY Name, DefinitionId
```

{% endcode %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://dev.ucommerce.net/readme/how-to/migrate-from-classic/common-database-issues.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
