<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20211129104802 extends AbstractMigration
{
public function getDescription(): string
{
return '';
}
public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE logs CHANGE type type enum(\'mail\', \'sms\')');
$this->addSql('ALTER TABLE payments ADD subscription_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE payments ADD CONSTRAINT FK_65D29B329A1887DC FOREIGN KEY (subscription_id) REFERENCES subscriptions (id)');
$this->addSql('CREATE INDEX IDX_65D29B329A1887DC ON payments (subscription_id)');
$this->addSql('ALTER TABLE subscriptions DROP FOREIGN KEY FK_4778A014C3A3BB');
$this->addSql('DROP INDEX UNIQ_4778A014C3A3BB ON subscriptions');
$this->addSql('ALTER TABLE subscriptions DROP payment_id, CHANGE transmission_type transmission_type enum(\'manual\',\'automatic\')');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE logs CHANGE type type VARCHAR(255) CHARACTER SET utf8mb4 DEFAULT NULL COLLATE `utf8mb4_unicode_ci`');
$this->addSql('ALTER TABLE payments DROP FOREIGN KEY FK_65D29B329A1887DC');
$this->addSql('DROP INDEX IDX_65D29B329A1887DC ON payments');
$this->addSql('ALTER TABLE payments DROP subscription_id');
$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`');
$this->addSql('ALTER TABLE subscriptions ADD CONSTRAINT FK_4778A014C3A3BB FOREIGN KEY (payment_id) REFERENCES payments (id) ON UPDATE NO ACTION ON DELETE NO ACTION');
$this->addSql('CREATE UNIQUE INDEX UNIQ_4778A014C3A3BB ON subscriptions (payment_id)');
}
}