<?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 Version20241113144731 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 document_information_getax_xmlfield (document_information_id INT NOT NULL, getax_xmlfield_id INT NOT NULL, INDEX IDX_3FE7665954BDC40D (document_information_id), INDEX IDX_3FE7665911D0A772 (getax_xmlfield_id), PRIMARY KEY(document_information_id, getax_xmlfield_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE getax_document (id INT AUTO_INCREMENT NOT NULL, document VARCHAR(255) NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE getax_xmlfield (id INT AUTO_INCREMENT NOT NULL, document_id INT NOT NULL, code_bar_f VARCHAR(255) DEFAULT NULL, cod_v VARCHAR(255) DEFAULT NULL, new_code VARCHAR(255) DEFAULT NULL, control_logiciel VARCHAR(255) DEFAULT NULL, type_donne VARCHAR(255) DEFAULT NULL, format VARCHAR(255) DEFAULT NULL, rubrique VARCHAR(1000) DEFAULT NULL, default_value VARCHAR(255) DEFAULT NULL, INDEX IDX_A22157BFC33F7837 (document_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE getax_xmlfield_survey_step_field (getax_xmlfield_id INT NOT NULL, survey_step_field_id INT NOT NULL, INDEX IDX_58EFBD2B11D0A772 (getax_xmlfield_id), INDEX IDX_58EFBD2B1F298627 (survey_step_field_id), PRIMARY KEY(getax_xmlfield_id, survey_step_field_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE document_information_getax_xmlfield ADD CONSTRAINT FK_3FE7665954BDC40D FOREIGN KEY (document_information_id) REFERENCES document_information (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE document_information_getax_xmlfield ADD CONSTRAINT FK_3FE7665911D0A772 FOREIGN KEY (getax_xmlfield_id) REFERENCES getax_xmlfield (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE getax_xmlfield ADD CONSTRAINT FK_A22157BFC33F7837 FOREIGN KEY (document_id) REFERENCES getax_document (id)');
$this->addSql('ALTER TABLE getax_xmlfield_survey_step_field ADD CONSTRAINT FK_58EFBD2B11D0A772 FOREIGN KEY (getax_xmlfield_id) REFERENCES getax_xmlfield (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE getax_xmlfield_survey_step_field ADD CONSTRAINT FK_58EFBD2B1F298627 FOREIGN KEY (survey_step_field_id) REFERENCES survey_step_field (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE getax_mc ADD getax_xmlfield_id INT DEFAULT NULL, DROP code_f, DROP code_v');
$this->addSql('ALTER TABLE getax_mc ADD CONSTRAINT FK_9FE0C05511D0A772 FOREIGN KEY (getax_xmlfield_id) REFERENCES getax_xmlfield (id)');
$this->addSql('CREATE INDEX IDX_9FE0C05511D0A772 ON getax_mc (getax_xmlfield_id)');
$this->addSql("insert into getax_document(document) values ('PG1'),('PG2'),('PG3'),('PG4'),('A1'),('A2'),('A8'),('A9'),('B'),('C1'),('C2'),('C3'),('C4'),('D'),('E'),('F'),('G'),('Q');");
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE getax_xmlfield DROP FOREIGN KEY FK_A22157BFC33F7837');
$this->addSql('ALTER TABLE document_information_getax_xmlfield DROP FOREIGN KEY FK_3FE7665911D0A772');
$this->addSql('ALTER TABLE getax_mc DROP FOREIGN KEY FK_9FE0C05511D0A772');
$this->addSql('ALTER TABLE getax_xmlfield_survey_step_field DROP FOREIGN KEY FK_58EFBD2B11D0A772');
$this->addSql('DROP TABLE document_information_getax_xmlfield');
$this->addSql('DROP TABLE getax_document');
$this->addSql('DROP TABLE getax_xmlfield');
$this->addSql('DROP TABLE getax_xmlfield_survey_step_field');
$this->addSql('DROP INDEX IDX_9FE0C05511D0A772 ON getax_mc');
$this->addSql('ALTER TABLE getax_mc ADD code_f VARCHAR(255) CHARACTER SET utf8mb4 DEFAULT NULL COLLATE `utf8mb4_unicode_ci`, ADD code_v VARCHAR(255) CHARACTER SET utf8mb4 DEFAULT NULL COLLATE `utf8mb4_unicode_ci`, DROP getax_xmlfield_id');
}
}