migrations/Version20140923160937.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 Version20140923160937 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 site_address (id INT AUTO_INCREMENT NOT NULL, customer INT DEFAULT NULL, address_1 VARCHAR(255) DEFAULT NULL, address_2 VARCHAR(255) DEFAULT NULL, city VARCHAR(255) DEFAULT NULL, postcode VARCHAR(8) DEFAULT NULL, deletedAt DATETIME DEFAULT NULL, address_string VARCHAR(255) DEFAULT NULL, INDEX IDX_F6EA8D4A81398E09 (customer), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB');
  15.         $this->addSql('CREATE TABLE billing_address (id INT AUTO_INCREMENT NOT NULL, customer INT DEFAULT NULL, address_1 VARCHAR(255) DEFAULT NULL, address_2 VARCHAR(255) DEFAULT NULL, city VARCHAR(255) DEFAULT NULL, postcode VARCHAR(8) DEFAULT NULL, deletedAt DATETIME DEFAULT NULL, UNIQUE INDEX UNIQ_6660E45681398E09 (customer), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB');
  16.         $this->addSql('ALTER TABLE site_address ADD CONSTRAINT FK_F6EA8D4A81398E09 FOREIGN KEY (customer) REFERENCES customer (id)');
  17.         $this->addSql('ALTER TABLE billing_address ADD CONSTRAINT FK_6660E45681398E09 FOREIGN KEY (customer) REFERENCES customer (id)');
  18.         $this->addSql('ALTER TABLE truck ADD purchased_date DATETIME DEFAULT NULL, ADD email VARCHAR(255) DEFAULT NULL, ADD telephone VARCHAR(255) DEFAULT NULL, DROP other_info');
  19.         $this->addSql('ALTER TABLE customer DROP site_address, DROP postcode, DROP billing_address');
  20.     }
  21.     public function down(Schema $schema): void
  22.     {
  23.         // this down() migration is auto-generated, please modify it to your needs
  24.         $this->abortIf($this->connection->getDatabasePlatform()->getName() != 'mysql'"Migration can only be executed safely on 'mysql'.");
  25.         $this->addSql('DROP TABLE site_address');
  26.         $this->addSql('DROP TABLE billing_address');
  27.         $this->addSql('ALTER TABLE customer ADD site_address VARCHAR(255) DEFAULT NULL, ADD postcode LONGTEXT DEFAULT NULL, ADD billing_address LONGTEXT DEFAULT NULL');
  28.         $this->addSql('ALTER TABLE truck ADD other_info LONGTEXT DEFAULT NULL, DROP purchased_date, DROP email, DROP telephone');
  29.     }
  30. }