migrations/Version20140925133451.php line 1

Open in your IDE?
  1. <?php
  2. namespace DoctrineMigrations;
  3. use Doctrine\DBAL\Schema\Schema;
  4. use Doctrine\Migrations\AbstractMigration;
  5. /**
  6.  * Auto-generated Migration: Please modify to your needs!
  7.  */
  8. class Version20140925133451 extends AbstractMigration
  9. {
  10.     public function up(Schema $schema): void
  11.     {
  12.         // this up() migration is auto-generated, please modify it to your needs
  13.         $this->abortIf($this->connection->getDatabasePlatform()->getName() != 'mysql'"Migration can only be executed safely on 'mysql'.");
  14.         $this->addSql('ALTER TABLE truck DROP FOREIGN KEY FK_CDCCF30AD79572D9');
  15.         $this->addSql('CREATE TABLE truck_make (id INT AUTO_INCREMENT NOT NULL, name VARCHAR(255) NOT NULL, deletedAt DATETIME DEFAULT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB');
  16.         $this->addSql('CREATE TABLE truck_model (id INT AUTO_INCREMENT NOT NULL, make_id INT DEFAULT NULL, name VARCHAR(255) DEFAULT NULL, mast TINYTEXT DEFAULT NULL, mastHeight INT DEFAULT NULL, hydraulics LONGTEXT DEFAULT NULL, attachments LONGTEXT DEFAULT NULL, yom INT DEFAULT NULL, weather_protection LONGTEXT DEFAULT NULL, tyre_type LONGTEXT DEFAULT NULL, performance_indicator LONGTEXT DEFAULT NULL, deletedAt DATETIME DEFAULT NULL, INDEX IDX_564EC303CFBF73EB (make_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB');
  17.         $this->addSql('ALTER TABLE truck_model ADD CONSTRAINT FK_564EC303CFBF73EB FOREIGN KEY (make_id) REFERENCES truck_make (id)');
  18.         $this->addSql('DROP TABLE truckmodel');
  19.         $this->addSql('DROP INDEX IDX_CDCCF30AD79572D9 ON truck');
  20.         $this->addSql('ALTER TABLE truck ADD name INT DEFAULT NULL, ADD loler_interval INT DEFAULT NULL, ADD service_interval INT DEFAULT NULL, ADD warranty LONGTEXT DEFAULT NULL, ADD siteAddress_id INT DEFAULT NULL, CHANGE model truck_make INT DEFAULT NULL');
  21.         $this->addSql('ALTER TABLE truck ADD CONSTRAINT FK_CDCCF30A7F6B61BA FOREIGN KEY (truck_make) REFERENCES truck_make (id)');
  22.         $this->addSql('ALTER TABLE truck ADD CONSTRAINT FK_CDCCF30A5E237E06 FOREIGN KEY (name) REFERENCES truck_model (id)');
  23.         $this->addSql('ALTER TABLE truck ADD CONSTRAINT FK_CDCCF30A917C7BCD FOREIGN KEY (siteAddress_id) REFERENCES site_address (id)');
  24.         $this->addSql('CREATE INDEX IDX_CDCCF30A7F6B61BA ON truck (truck_make)');
  25.         $this->addSql('CREATE INDEX IDX_CDCCF30A5E237E06 ON truck (name)');
  26.         $this->addSql('CREATE INDEX IDX_CDCCF30A917C7BCD ON truck (siteAddress_id)');
  27.     }
  28.     public function down(Schema $schema): void
  29.     {
  30.         // this down() migration is auto-generated, please modify it to your needs
  31.         $this->abortIf($this->connection->getDatabasePlatform()->getName() != 'mysql'"Migration can only be executed safely on 'mysql'.");
  32.         $this->addSql('ALTER TABLE truck DROP FOREIGN KEY FK_CDCCF30A7F6B61BA');
  33.         $this->addSql('ALTER TABLE truck_model DROP FOREIGN KEY FK_564EC303CFBF73EB');
  34.         $this->addSql('ALTER TABLE truck DROP FOREIGN KEY FK_CDCCF30A5E237E06');
  35.         $this->addSql('CREATE TABLE truckmodel (id INT AUTO_INCREMENT NOT NULL, make VARCHAR(255) DEFAULT NULL, model VARCHAR(255) DEFAULT NULL, mast LONGTEXT DEFAULT NULL, hydraulics LONGTEXT DEFAULT NULL, attachments LONGTEXT DEFAULT NULL, yom INT DEFAULT NULL, weather_protection LONGTEXT DEFAULT NULL, tyre_type LONGTEXT DEFAULT NULL, loler_interval INT DEFAULT NULL, service_interval INT DEFAULT NULL, warranty LONGTEXT DEFAULT NULL, performance_indicator LONGTEXT DEFAULT NULL, deletedAt DATETIME DEFAULT NULL, mastHeight INT DEFAULT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB');
  36.         $this->addSql('DROP TABLE truck_make');
  37.         $this->addSql('DROP TABLE truck_model');
  38.         $this->addSql('DROP INDEX IDX_CDCCF30A7F6B61BA ON truck');
  39.         $this->addSql('DROP INDEX IDX_CDCCF30A5E237E06 ON truck');
  40.         $this->addSql('DROP INDEX IDX_CDCCF30A917C7BCD ON truck');
  41.         $this->addSql('ALTER TABLE truck ADD model INT DEFAULT NULL, DROP truck_make, DROP name, DROP loler_interval, DROP service_interval, DROP warranty, DROP siteAddress_id');
  42.         $this->addSql('ALTER TABLE truck ADD CONSTRAINT FK_CDCCF30AD79572D9 FOREIGN KEY (model) REFERENCES truckmodel (id)');
  43.         $this->addSql('CREATE INDEX IDX_CDCCF30AD79572D9 ON truck (model)');
  44.     }
  45. }