migrations/Version20140729190536.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 Version20140729190536 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('CREATE TABLE truckmodel (id INT AUTO_INCREMENT NOT NULL, make VARCHAR(255) NOT NULL, model VARCHAR(255) DEFAULT NULL, mast TINYTEXT DEFAULT NULL, hydraulics LONGTEXT DEFAULT NULL, attachments LONGTEXT DEFAULT NULL, yom INT DEFAULT NULL, weather_protection LONGTEXT DEFAULT NULL, tyre_type LONGTEXT DEFAULT NULL, maintenance 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, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB');
  15.         $this->addSql('ALTER TABLE truck DROP make, DROP warranty, DROP service_interval, DROP mast, DROP hydraulics, DROP attachments, DROP yom, DROP performance_indicator, DROP purchase, DROP maintenance, DROP loler_interval, DROP weather_protection, DROP tyre_type, CHANGE model model INT DEFAULT NULL');
  16.         $this->addSql('ALTER TABLE truck ADD CONSTRAINT FK_CDCCF30AD79572D9 FOREIGN KEY (model) REFERENCES truckmodel (id)');
  17.         $this->addSql('CREATE INDEX IDX_CDCCF30AD79572D9 ON truck (model)');
  18.     }
  19.     public function down(Schema $schema): void
  20.     {
  21.         // this down() migration is auto-generated, please modify it to your needs
  22.         $this->abortIf($this->connection->getDatabasePlatform()->getName() != 'mysql'"Migration can only be executed safely on 'mysql'.");
  23.         $this->addSql('ALTER TABLE truck DROP FOREIGN KEY FK_CDCCF30AD79572D9');
  24.         $this->addSql('DROP TABLE truckmodel');
  25.         $this->addSql('DROP INDEX IDX_CDCCF30AD79572D9 ON truck');
  26.         $this->addSql('ALTER TABLE truck ADD make LONGTEXT DEFAULT NULL, ADD warranty LONGTEXT DEFAULT NULL, ADD service_interval INT DEFAULT NULL, ADD mast LONGTEXT DEFAULT NULL, ADD hydraulics LONGTEXT DEFAULT NULL, ADD attachments LONGTEXT DEFAULT NULL, ADD yom INT DEFAULT NULL, ADD performance_indicator LONGTEXT DEFAULT NULL, ADD purchase TINYINT(1) DEFAULT NULL, ADD maintenance LONGTEXT DEFAULT NULL, ADD loler_interval INT DEFAULT NULL, ADD weather_protection LONGTEXT DEFAULT NULL, ADD tyre_type LONGTEXT DEFAULT NULL, CHANGE model model LONGTEXT DEFAULT NULL');
  27.     }
  28. }