migrations/Version20150225180251.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 Version20150225180251 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 reminder (id INT AUTO_INCREMENT NOT NULL, lead_id INT DEFAULT NULL, detail VARCHAR(255) DEFAULT NULL, date DATETIME NOT NULL, type VARCHAR(255) DEFAULT NULL, deletedAt DATETIME DEFAULT NULL, INDEX IDX_40374F4055458D (lead_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB');
  15.         $this->addSql('CREATE TABLE reminder_user (reminder_id INT NOT NULL, user_id INT NOT NULL, INDEX IDX_9A6F0A60D987BE75 (reminder_id), INDEX IDX_9A6F0A60A76ED395 (user_id), PRIMARY KEY(reminder_id, user_id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB');
  16.         $this->addSql('ALTER TABLE reminder ADD CONSTRAINT FK_40374F4055458D FOREIGN KEY (lead_id) REFERENCES leads (id)');
  17.         $this->addSql('ALTER TABLE reminder_user ADD CONSTRAINT FK_9A6F0A60D987BE75 FOREIGN KEY (reminder_id) REFERENCES reminder (id) ON DELETE CASCADE');
  18.         $this->addSql('ALTER TABLE reminder_user ADD CONSTRAINT FK_9A6F0A60A76ED395 FOREIGN KEY (user_id) REFERENCES user (id) ON DELETE CASCADE');
  19.         $this->addSql('ALTER TABLE purchase_order ADD supplier_id INT DEFAULT NULL, ADD deletedAt DATETIME DEFAULT NULL');
  20.         $this->addSql('ALTER TABLE purchase_order ADD CONSTRAINT FK_21E210B22ADD6D8C FOREIGN KEY (supplier_id) REFERENCES supplier (id) ON DELETE SET NULL');
  21.         $this->addSql('CREATE INDEX IDX_21E210B22ADD6D8C ON purchase_order (supplier_id)');
  22.         $this->addSql('ALTER TABLE purchase_order_item ADD deletedAt DATETIME DEFAULT NULL');
  23.     }
  24.     public function down(Schema $schema): void
  25.     {
  26.         // this down() migration is auto-generated, please modify it to your needs
  27.         $this->abortIf($this->connection->getDatabasePlatform()->getName() != 'mysql''Migration can only be executed safely on \'mysql\'.');
  28.         $this->addSql('ALTER TABLE reminder_user DROP FOREIGN KEY FK_9A6F0A60D987BE75');
  29.         $this->addSql('DROP TABLE reminder');
  30.         $this->addSql('DROP TABLE reminder_user');
  31.         $this->addSql('ALTER TABLE purchase_order DROP FOREIGN KEY FK_21E210B22ADD6D8C');
  32.         $this->addSql('DROP INDEX IDX_21E210B22ADD6D8C ON purchase_order');
  33.         $this->addSql('ALTER TABLE purchase_order DROP supplier_id, DROP deletedAt');
  34.         $this->addSql('ALTER TABLE purchase_order_item DROP deletedAt');
  35.     }
  36. }