migrations/Version20230608135857.php line 1

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace DoctrineMigrations;
  4. use App\Utils\CommonFunctions;
  5. use Doctrine\DBAL\Schema\Schema;
  6. use Doctrine\Migrations\AbstractMigration;
  7. /**
  8.  * Auto-generated Migration: Please modify to your needs!
  9.  */
  10. final class Version20230608135857 extends AbstractMigration
  11. {
  12.     public function getDescription(): string
  13.     {
  14.         return '';
  15.     }
  16.     public function up(Schema $schema): void
  17.     {
  18.         // this up() migration is auto-generated, please modify it to your needs
  19.         $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 = \'\' ');
  20.         $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 = \'\' ');
  21.         $this->addSql('ALTER TABLE ficha_tramite ADD CONSTRAINT ficha_tramite_tramite_id_fk FOREIGN KEY (tramite_id) REFERENCES tramite (id)');
  22.         $this->addSql('ALTER TABLE ficha_tramite ADD CONSTRAINT ficha_tramite_modulos_id_fk FOREIGN KEY (modulo_id) REFERENCES modulos (id)');
  23.         $this->addSql(CommonFunctions::getFile(__DIR__ '/Data/FichaTramite/insert_modulos.sql'));
  24.     }
  25.     public function down(Schema $schema): void
  26.     {
  27.         // this down() migration is auto-generated, please modify it to your needs
  28.         $this->addSql('ALTER TABLE ficha_tramite DROP FOREIGN KEY ficha_tramite_tramite_id_fk');
  29.         $this->addSql('ALTER TABLE ficha_tramite DROP FOREIGN KEY ficha_tramite_modulos_id_fk');
  30.         $this->addSql('DROP TABLE modulos');
  31.         $this->addSql('DROP TABLE ficha_tramite');
  32.     }
  33. }