SuperSeller3000/migrations/Version20260517222701.php
Simon Kuehn 838b96eb14 feat: required/optional attribute sections in ArticleType form
Promote article_type_attributes join table to ArticleTypeAttribute entity
with a required boolean flag. ArticleType gains virtual form properties
(requiredAttributeDefs / optionalAttributeDefs) reconciled via
applyAttributeAssignments() on persist/update.

Admin form shows two Tom Select multi-selects; a small JS module
(article-type-attr-sync.js) listens for ea.autocomplete.connect events
and keeps the two lists mutually exclusive in real time.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-17 22:43:42 +00:00

34 lines
1.5 KiB
PHP

<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
final class Version20260517222701 extends AbstractMigration
{
public function getDescription(): string
{
return 'Promote article_type_attributes join table to entity with id + required flag';
}
public function up(Schema $schema): void
{
$this->addSql('ALTER TABLE app.article_type_attributes ADD COLUMN id UUID DEFAULT gen_random_uuid() NOT NULL');
$this->addSql('ALTER TABLE app.article_type_attributes ADD COLUMN required BOOLEAN NOT NULL DEFAULT FALSE');
$this->addSql('ALTER TABLE app.article_type_attributes DROP CONSTRAINT article_type_attributes_pkey');
$this->addSql('ALTER TABLE app.article_type_attributes ADD PRIMARY KEY (id)');
$this->addSql('CREATE UNIQUE INDEX uniq_article_type_attribute ON app.article_type_attributes (article_type_id, attribute_definition_id)');
}
public function down(Schema $schema): void
{
$this->addSql('DROP INDEX app.uniq_article_type_attribute');
$this->addSql('ALTER TABLE app.article_type_attributes DROP CONSTRAINT article_type_attributes_pkey');
$this->addSql('ALTER TABLE app.article_type_attributes DROP COLUMN id');
$this->addSql('ALTER TABLE app.article_type_attributes DROP COLUMN required');
$this->addSql('ALTER TABLE app.article_type_attributes ADD PRIMARY KEY (article_type_id, attribute_definition_id)');
}
}