SuperSeller3000/migrations/Version20260520100000.php
Simon Kuehn bf1af0a0bf feat: replace JSON ebay mappings with ArticleTypeEbayMapping entity
Introduces a proper key-value table (article_type_ebay_mappings) that
explicitly maps each eBay aspect name to either an Article field
(manufacturer, modelNumber, …) or an AttributeDefinition, with a
required flag per mapping entry.

- New entity ArticleTypeEbayMapping with SOURCE_ARTICLE_FIELD / SOURCE_ATTRIBUTE
- ArticleType gains OneToMany ebayMappings collection with upsertEbayMapping()
- EbayAdapter.buildAspects() reads from the mapping table instead of implicit name-matching
- Import controller persists mappings via upsertEbayMapping() and syncs required attribute assignments
- Template shows active mappings card and article_field action option
- Migration 20260520100000 creates the new table, drops old JSON column

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-18 20:52:25 +00:00

44 lines
1.6 KiB
PHP

<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
final class Version20260520100000 extends AbstractMigration
{
public function getDescription(): string
{
return 'Replace ebay_aspect_field_mappings JSON with article_type_ebay_mappings table';
}
public function up(Schema $schema): void
{
$this->addSql("
CREATE TABLE app.article_type_ebay_mappings (
id UUID NOT NULL,
article_type_id UUID NOT NULL,
ebay_aspect_name VARCHAR(255) NOT NULL,
source_type VARCHAR(30) NOT NULL,
article_field_key VARCHAR(100) DEFAULT NULL,
attribute_definition_id UUID DEFAULT NULL,
required BOOLEAN NOT NULL DEFAULT FALSE,
PRIMARY KEY (id),
UNIQUE (article_type_id, ebay_aspect_name),
CONSTRAINT fk_etm_article_type FOREIGN KEY (article_type_id)
REFERENCES app.article_types (id) ON DELETE CASCADE,
CONSTRAINT fk_etm_attr_def FOREIGN KEY (attribute_definition_id)
REFERENCES app.attribute_definitions (id) ON DELETE SET NULL
)
");
$this->addSql("ALTER TABLE app.article_types DROP COLUMN IF EXISTS ebay_aspect_field_mappings");
}
public function down(Schema $schema): void
{
$this->addSql("DROP TABLE app.article_type_ebay_mappings");
$this->addSql("ALTER TABLE app.article_types ADD COLUMN ebay_aspect_field_mappings JSON DEFAULT NULL");
}
}