Skip to content

Duplicate value when migrating from Oro 5.0 #1125

@carbsrule

Description

@carbsrule

Summary
Migrations cause duplicate key violation in oro_enum_dashboard_type

Steps to reproduce
Run bin/console oro:migration:load --force on an Oro 6.1 environment with code/DB from an existing 5.0 install

Actual Result
The following occurs when trying to run migrations from an Oro (Commerce) 5.0 install:

  > Oro\Bundle\DashboardBundle\Migrations\Schema\v1_8\AddDashboardType
    ERROR: An exception occurred while executing 'INSERT INTO oro_enum_dashboard_type (id, name, priority, is_default) VALUES (?, ?, ?, ?)' with params ["widgets", "Widgets", 1, 1]:

SQLSTATE[23505]: Unique violation: 7 ERROR:  duplicate key value violates unique constraint "oro_enum_dashboard_type_pkey"
DETAIL:  Key (id)=(widgets) already exists.

Expected Result
Migrations should always work. In this particular case the code should check to see if the value already exists before blindly trying to create it.

Details about your environment

  • OroPlatform version: 6.1.0
  • PHP version: 8.4.6
  • Database (PostgreSQL) version: 16.1
  • Server operating system: Ubuntu 64-bit

Additional information
N/A

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions