migrations/Version20141016220938.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 Version20141016220938 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 estimate DROP FOREIGN KEY FK_D2EA460781398E09');
  15.         $this->addSql('DROP INDEX IDX_D2EA460781398E09 ON estimate');
  16.         $this->addSql('ALTER TABLE estimate ADD job_id INT DEFAULT NULL, CHANGE customer customer_id INT DEFAULT NULL');
  17.         $this->addSql('ALTER TABLE estimate ADD CONSTRAINT FK_D2EA46079395C3F3 FOREIGN KEY (customer_id) REFERENCES customer (id)');
  18.         $this->addSql('ALTER TABLE estimate ADD CONSTRAINT FK_D2EA4607BE04EA9 FOREIGN KEY (job_id) REFERENCES job (id)');
  19.         $this->addSql('CREATE INDEX IDX_D2EA46079395C3F3 ON estimate (customer_id)');
  20.         $this->addSql('CREATE INDEX IDX_D2EA4607BE04EA9 ON estimate (job_id)');
  21.         $this->addSql('ALTER TABLE job ADD cause VARCHAR(255) DEFAULT NULL, ADD requested_parts_text VARCHAR(255) DEFAULT NULL, ADD parts_ordered TINYINT(1) NOT NULL, DROP estimate');
  22.     }
  23.     public function down(Schema $schema): void
  24.     {
  25.         // this down() migration is auto-generated, please modify it to your needs
  26.         $this->abortIf($this->connection->getDatabasePlatform()->getName() != 'mysql'"Migration can only be executed safely on 'mysql'.");
  27.         $this->addSql('ALTER TABLE estimate DROP FOREIGN KEY FK_D2EA46079395C3F3');
  28.         $this->addSql('ALTER TABLE estimate DROP FOREIGN KEY FK_D2EA4607BE04EA9');
  29.         $this->addSql('DROP INDEX IDX_D2EA46079395C3F3 ON estimate');
  30.         $this->addSql('DROP INDEX IDX_D2EA4607BE04EA9 ON estimate');
  31.         $this->addSql('ALTER TABLE estimate ADD customer INT DEFAULT NULL, DROP customer_id, DROP job_id');
  32.         $this->addSql('ALTER TABLE estimate ADD CONSTRAINT FK_D2EA460781398E09 FOREIGN KEY (customer) REFERENCES customer (id)');
  33.         $this->addSql('CREATE INDEX IDX_D2EA460781398E09 ON estimate (customer)');
  34.         $this->addSql('ALTER TABLE job ADD estimate NUMERIC(8, 2) DEFAULT NULL, DROP cause, DROP requested_parts_text, DROP parts_ordered');
  35.     }
  36. }