<?php
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
class Version20141010113708 extends AbstractMigration
{
public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$this->abortIf($this->connection->getDatabasePlatform()->getName() != 'mysql', "Migration can only be executed safely on 'mysql'.");
$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');
$this->addSql('ALTER TABLE contact ADD CONSTRAINT FK_4C62E638C6957CCE FOREIGN KEY (truck_id) REFERENCES truck (id)');
$this->addSql('ALTER TABLE contact ADD CONSTRAINT FK_4C62E6389395C3F3 FOREIGN KEY (customer_id) REFERENCES customer (id)');
$this->addSql('ALTER TABLE customer DROP contactName');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->abortIf($this->connection->getDatabasePlatform()->getName() != 'mysql', "Migration can only be executed safely on 'mysql'.");
$this->addSql('DROP TABLE contact');
$this->addSql('ALTER TABLE customer ADD contactName LONGTEXT DEFAULT NULL');
}
}