<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use App\Utils\CommonFunctions;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20230608135857 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 modulos (id INT AUTO_INCREMENT NOT NULL, nombre VARCHAR(255) CHARACTER SET utf8 NOT NULL COLLATE `utf8_general_ci`, codigo VARCHAR(100) CHARACTER SET utf8 NOT NULL COLLATE `utf8_general_ci`, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_general_ci` ENGINE = InnoDB COMMENT = \'\' ');
$this->addSql('CREATE TABLE ficha_tramite (id INT AUTO_INCREMENT NOT NULL, tramite_id INT NOT NULL, modulo_id INT NOT NULL, data LONGTEXT CHARACTER SET utf8mb4 NOT NULL COLLATE `utf8mb4_bin`, INDEX ficha_tramite_modulos_id_fk (modulo_id), INDEX ficha_tramite_tramite_id_fk (tramite_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_general_ci` ENGINE = InnoDB COMMENT = \'\' ');
$this->addSql('ALTER TABLE ficha_tramite ADD CONSTRAINT ficha_tramite_tramite_id_fk FOREIGN KEY (tramite_id) REFERENCES tramite (id)');
$this->addSql('ALTER TABLE ficha_tramite ADD CONSTRAINT ficha_tramite_modulos_id_fk FOREIGN KEY (modulo_id) REFERENCES modulos (id)');
$this->addSql(CommonFunctions::getFile(__DIR__ . '/Data/FichaTramite/insert_modulos.sql'));
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE ficha_tramite DROP FOREIGN KEY ficha_tramite_tramite_id_fk');
$this->addSql('ALTER TABLE ficha_tramite DROP FOREIGN KEY ficha_tramite_modulos_id_fk');
$this->addSql('DROP TABLE modulos');
$this->addSql('DROP TABLE ficha_tramite');
}
}