<?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 Version20241030103332 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 form_section (id INT AUTO_INCREMENT NOT NULL, form_id INT NOT NULL, version INT NOT NULL, surveyjs_form_content JSON NOT NULL, description LONGTEXT DEFAULT NULL, options JSON DEFAULT NULL, is_required TINYINT(1) NOT NULL, hash VARCHAR(255) NOT NULL, status INT NOT NULL, is_removed TINYINT(1) NOT NULL, cdate DATETIME NOT NULL, mdate DATETIME DEFAULT NULL, UNIQUE INDEX UNIQ_1C1F1AD4D1B862B8 (hash), INDEX IDX_1C1F1AD45FF69B7D (form_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE taxation_answer (id INT AUTO_INCREMENT NOT NULL, customer_id INT NOT NULL, taxation_form_section_id INT NOT NULL, answers JSON NOT NULL, hash VARCHAR(255) NOT NULL, status INT NOT NULL, is_removed TINYINT(1) NOT NULL, cdate DATETIME NOT NULL, mdate DATETIME DEFAULT NULL, UNIQUE INDEX UNIQ_8211DD16D1B862B8 (hash), INDEX IDX_8211DD169395C3F3 (customer_id), INDEX IDX_8211DD1687D9174 (taxation_form_section_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE taxation_form_section (id INT AUTO_INCREMENT NOT NULL, taxation_id INT NOT NULL, form_section_id INT NOT NULL, version_copy INT NOT NULL, survey_copy JSON NOT NULL, is_required TINYINT(1) NOT NULL, hash VARCHAR(255) NOT NULL, status INT NOT NULL, is_removed TINYINT(1) NOT NULL, cdate DATETIME NOT NULL, mdate DATETIME DEFAULT NULL, UNIQUE INDEX UNIQ_A3E3BA61D1B862B8 (hash), INDEX IDX_A3E3BA612224E81F (taxation_id), INDEX IDX_A3E3BA61D1E4AFEE (form_section_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE form_section ADD CONSTRAINT FK_1C1F1AD45FF69B7D FOREIGN KEY (form_id) REFERENCES form (id)');
$this->addSql('ALTER TABLE taxation_answer ADD CONSTRAINT FK_8211DD169395C3F3 FOREIGN KEY (customer_id) REFERENCES customer (id)');
$this->addSql('ALTER TABLE taxation_answer ADD CONSTRAINT FK_8211DD1687D9174 FOREIGN KEY (taxation_form_section_id) REFERENCES taxation_form_section (id)');
$this->addSql('ALTER TABLE taxation_form_section ADD CONSTRAINT FK_A3E3BA612224E81F FOREIGN KEY (taxation_id) REFERENCES taxation (id)');
$this->addSql('ALTER TABLE taxation_form_section ADD CONSTRAINT FK_A3E3BA61D1E4AFEE FOREIGN KEY (form_section_id) REFERENCES form_section (id)');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE form_section DROP FOREIGN KEY FK_1C1F1AD45FF69B7D');
$this->addSql('ALTER TABLE taxation_answer DROP FOREIGN KEY FK_8211DD169395C3F3');
$this->addSql('ALTER TABLE taxation_answer DROP FOREIGN KEY FK_8211DD1687D9174');
$this->addSql('ALTER TABLE taxation_form_section DROP FOREIGN KEY FK_A3E3BA612224E81F');
$this->addSql('ALTER TABLE taxation_form_section DROP FOREIGN KEY FK_A3E3BA61D1E4AFEE');
$this->addSql('DROP TABLE form_section');
$this->addSql('DROP TABLE taxation_answer');
$this->addSql('DROP TABLE taxation_form_section');
}
}