admin管理员组

文章数量:1390555

Internal Server Error
An exception occurred while executing a query: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'swag_example_size' for key 'custom_field.uniq.custom_field.name'

this is my migration

<?php declare(strict_types=1);

namespace SwagShopFinder\Migration;

use Doctrine\DBAL\Connection;
use Shopware\Core\Framework\Migration\MigrationStep;

/**
 * @internal
 */
class Migration1741862942 extends MigrationStep
{
    public function getCreationTimestamp(): int
    {
        return 1741862942;
    }

    public function update(Connection $connection): void
    {
        $connection->exec("CREATE TABLE IF NOT EXISTS swag_shop_finder ( 
  `id` BINARY(16) NOT NULL, 
    active TINYINT(1) NULL DEFAULT '0', 
    name VARCHAR(255) NOT NULL, 
    street VARCHAR(255) NOT NULL, 
    post_code VARCHAR(255) NOT NULL, 
    city VARCHAR(255) NOT NULL, 
    url VARCHAR(255) NULL, 
    telephone VARCHAR(255) NULL, 
    open_times LONGTEXT NULL, 
    country_id BINARY(16) NULL, 
    createdAt DATETIME(3), 
    updatedAt DATETIME(3), 
    PRIMARY KEY (id), 
    KEY `fk_swag_shop_finder_country_id` (country_id), 
    CONSTRAINT `fk_swag_shop_finder_country_id` 
        FOREIGN KEY (country_id) 
        REFERENCES country (id) 
        ON DELETE RESTRICT 
        ON UPDATE CASCADE 
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
");    
    }
}

本文标签: sqlShopware 6 1062 error when trying to run a migrationStack Overflow