migrations/Version20230125175903.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 Version20230125175903 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('ALTER TABLE licencia_conducir DROP FOREIGN KEY FK_E20963FD10D3FB8D');
  20.         $this->addSql('TRUNCATE licencia_conducir');
  21.         $this->addSql('DROP TABLE licencia_conducir');
  22.         $this->addSql('CREATE TABLE licencia_conducir (id INT AUTO_INCREMENT NOT NULL, tipo_vehiculo_id INT DEFAULT NULL, clase VARCHAR(255) NOT NULL, descripcion VARCHAR(1200) NOT NULL, edad INT DEFAULT NULL, licencias_anteriores VARCHAR(255) DEFAULT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, deleted_at DATETIME DEFAULT NULL, INDEX IDX_E20963FD10D3FB8D (tipo_vehiculo_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  23.         $this->addSql('ALTER TABLE licencia_conducir ADD CONSTRAINT FK_E20963FD10D3FB8D FOREIGN KEY (tipo_vehiculo_id) REFERENCES tipo_vehiculo (id)');
  24.         $this->addSql('DELETE FROM tipo_vehiculo');
  25.         $this->addSql('ALTER TABLE tipo_vehiculo AUTO_INCREMENT = 1');
  26.         
  27.         $this->addSql(CommonFunctions::getFile(__DIR__ '/Data/LicenciasConducir/update_licencias.sql'));
  28.     }
  29.     public function down(Schema $schema): void
  30.     {
  31.         // this down() migration is auto-generated, please modify it to your needs
  32.     }
  33. }