migrations/Version20141010113708.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 Version20141010113708 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 contact (id INT AUTO_INCREMENT NOT NULL, truck_id INT DEFAULT NULL, customer_id INT DEFAULT NULL, name VARCHAR(255) NOT NULL, email VARCHAR(255) NOT NULL, telephone VARCHAR(255) NOT NULL, deletedAt DATETIME DEFAULT NULL, contact_string VARCHAR(255) DEFAULT NULL, INDEX IDX_4C62E638C6957CCE (truck_id), INDEX IDX_4C62E6389395C3F3 (customer_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB');
  15.         $this->addSql('ALTER TABLE contact ADD CONSTRAINT FK_4C62E638C6957CCE FOREIGN KEY (truck_id) REFERENCES truck (id)');
  16.         $this->addSql('ALTER TABLE contact ADD CONSTRAINT FK_4C62E6389395C3F3 FOREIGN KEY (customer_id) REFERENCES customer (id)');
  17.         $this->addSql('ALTER TABLE customer DROP contactName');
  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('DROP TABLE contact');
  24.         $this->addSql('ALTER TABLE customer ADD contactName LONGTEXT DEFAULT NULL');
  25.     }
  26. }