Ucommerce
  • Ucommerce Next Gen
    • Getting Started
      • Prerequisites
      • Licensing
      • Ucommerce Templates
      • Headless Template
      • MVC Template
    • Headless
      • Postman Collection
      • Headless API Authentication
        • Token endpoint - Authorization Header
        • Authorization Scopes
        • Refreshing the Access Token
      • Reference
        • Cart
        • Cart / Order Line Items
        • Shipment
        • Billing
        • Promotion Codes
        • Price Groups
        • Payment Methods
        • Countries
        • Shipping Methods
        • Catalogs
        • Cart Custom Properties
        • Line Item Custom Properties
        • Orders
        • Views for Cart modifying operations
      • Custom Headless APIs
      • Error Handling
      • Pagination
      • Deprecation
    • Backoffice Authentication
      • Microsoft Entra ID Example
      • Auth0 Authentication Example
    • Definitions
      • What is a Definition
    • Search and indexing
      • Configuration
      • Indexing
        • Index Definitions
        • Facets
        • Indexing Prices
        • Suggestions
        • Custom Data
      • Searching
    • Payment Providers
      • Stripe Provider Integration
      • Implementing a custom payment provider
    • Data Import
    • Miscellaneous
      • Media
      • Price Group Inheritance
      • Price Group Criteria
      • Soft Deletion Of Entities
      • Logging
      • OpenTelemetry
    • Extensions
      • Extending Pipelines
        • Order Processing Pipelines
        • Checkout Pipelines
      • Changing Service Behavior
        • Images
        • Content
      • Custom Headless APIs
      • Extend the Backoffice
        • Custom UI Components
      • Custom Editor UI
      • Custom Promotion Criteria
      • Custom Price Group Criteria
    • How-To
      • Migrate from Classic
        • Common database issues
      • Entities from code
        • Bootstrapping data on startup
        • Product Definitions & Fields
      • Discover pipelines and their tasks
      • Executing a pipeline
    • Integrations
      • Umbraco Media Delivery API
      • App Slices
        • Product Picker
  • Release Notes
  • Contact Us
Powered by GitBook
On this page

Was this helpful?

  1. Ucommerce Next Gen
  2. How-To
  3. Migrate from Classic

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:

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

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:

Product definitions
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
Other definitions
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
PreviousMigrate from ClassicNextEntities from code

Last updated 5 months ago

Was this helpful?