migrations/Version20211129104802.php line 1

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace DoctrineMigrations;
  4. use Doctrine\DBAL\Schema\Schema;
  5. use Doctrine\Migrations\AbstractMigration;
  6. /**
  7.  * Auto-generated Migration: Please modify to your needs!
  8.  */
  9. final class Version20211129104802 extends AbstractMigration
  10. {
  11.     public function getDescription(): string
  12.     {
  13.         return '';
  14.     }
  15.     public function up(Schema $schema): void
  16.     {
  17.         // this up() migration is auto-generated, please modify it to your needs
  18.         $this->addSql('ALTER TABLE logs CHANGE type type enum(\'mail\', \'sms\')');
  19.         $this->addSql('ALTER TABLE payments ADD subscription_id INT DEFAULT NULL');
  20.         $this->addSql('ALTER TABLE payments ADD CONSTRAINT FK_65D29B329A1887DC FOREIGN KEY (subscription_id) REFERENCES subscriptions (id)');
  21.         $this->addSql('CREATE INDEX IDX_65D29B329A1887DC ON payments (subscription_id)');
  22.         $this->addSql('ALTER TABLE subscriptions DROP FOREIGN KEY FK_4778A014C3A3BB');
  23.         $this->addSql('DROP INDEX UNIQ_4778A014C3A3BB ON subscriptions');
  24.         $this->addSql('ALTER TABLE subscriptions DROP payment_id, CHANGE transmission_type transmission_type enum(\'manual\',\'automatic\')');
  25.     }
  26.     public function down(Schema $schema): void
  27.     {
  28.         // this down() migration is auto-generated, please modify it to your needs
  29.         $this->addSql('ALTER TABLE logs CHANGE type type VARCHAR(255) CHARACTER SET utf8mb4 DEFAULT NULL COLLATE `utf8mb4_unicode_ci`');
  30.         $this->addSql('ALTER TABLE payments DROP FOREIGN KEY FK_65D29B329A1887DC');
  31.         $this->addSql('DROP INDEX IDX_65D29B329A1887DC ON payments');
  32.         $this->addSql('ALTER TABLE payments DROP subscription_id');
  33.         $this->addSql('ALTER TABLE subscriptions ADD payment_id INT DEFAULT NULL, CHANGE transmission_type transmission_type VARCHAR(255) CHARACTER SET utf8mb4 DEFAULT NULL COLLATE `utf8mb4_unicode_ci`');
  34.         $this->addSql('ALTER TABLE subscriptions ADD CONSTRAINT FK_4778A014C3A3BB FOREIGN KEY (payment_id) REFERENCES payments (id) ON UPDATE NO ACTION ON DELETE NO ACTION');
  35.         $this->addSql('CREATE UNIQUE INDEX UNIQ_4778A014C3A3BB ON subscriptions (payment_id)');
  36.     }
  37. }