<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
final class Version20261005190000 extends AbstractMigration
{
public function getDescription(): string
{
return 'Store step ordering separately for each product';
}
public function up(Schema $schema): void
{
$this->addSql('ALTER TABLE product_step ADD position INT DEFAULT 0 NOT NULL');
$this->addSql('UPDATE product_step ps INNER JOIN step s ON s.id = ps.step_id SET ps.position = s.position');
}
public function down(Schema $schema): void
{
$this->addSql('ALTER TABLE product_step DROP position');
}
}