<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20230216154658 extends AbstractMigration
{
public function getDescription(): string
{
return '';
}
public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$this->addSql('CREATE TABLE master_form (id INT AUTO_INCREMENT NOT NULL, uuid BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', active TINYINT(1) NOT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, name VARCHAR(255) NOT NULL, definition_file VARCHAR(255) NOT NULL, UNIQUE INDEX UNIQ_793DD026D17F50A6 (uuid), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE form DROP FOREIGN KEY FK_5288FD4F727ACA70');
$this->addSql('DROP INDEX IDX_5288FD4F727ACA70 ON form');
$this->addSql('ALTER TABLE form CHANGE parent_id master_form_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE form ADD CONSTRAINT FK_5288FD4F83D17615 FOREIGN KEY (master_form_id) REFERENCES master_form (id)');
$this->addSql('CREATE INDEX IDX_5288FD4F83D17615 ON form (master_form_id)');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE form DROP FOREIGN KEY FK_5288FD4F83D17615');
$this->addSql('DROP TABLE master_form');
$this->addSql('DROP INDEX IDX_5288FD4F83D17615 ON form');
$this->addSql('ALTER TABLE form CHANGE master_form_id parent_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE form ADD CONSTRAINT FK_5288FD4F727ACA70 FOREIGN KEY (parent_id) REFERENCES form (id) ON UPDATE NO ACTION ON DELETE NO ACTION');
$this->addSql('CREATE INDEX IDX_5288FD4F727ACA70 ON form (parent_id)');
}
}