migrations/Version20150402145711.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 Version20150402145711 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('DROP TABLE reminder_user');
  15.         $this->addSql('ALTER TABLE reminder ADD user_id INT DEFAULT NULL');
  16.         $this->addSql('ALTER TABLE reminder ADD CONSTRAINT FK_40374F40A76ED395 FOREIGN KEY (user_id) REFERENCES user (id)');
  17.         $this->addSql('CREATE INDEX IDX_40374F40A76ED395 ON reminder (user_id)');
  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('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');
  24.         $this->addSql('ALTER TABLE reminder_user ADD CONSTRAINT FK_9A6F0A60A76ED395 FOREIGN KEY (user_id) REFERENCES user (id) ON DELETE CASCADE');
  25.         $this->addSql('ALTER TABLE reminder_user ADD CONSTRAINT FK_9A6F0A60D987BE75 FOREIGN KEY (reminder_id) REFERENCES reminder (id) ON DELETE CASCADE');
  26.         $this->addSql('ALTER TABLE reminder DROP FOREIGN KEY FK_40374F40A76ED395');
  27.         $this->addSql('DROP INDEX IDX_40374F40A76ED395 ON reminder');
  28.         $this->addSql('ALTER TABLE reminder DROP user_id');
  29.     }
  30. }