<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
final class Version20230311114529 extends AbstractMigration
{
public function getDescription(): string
{
return 'Fix table schemas';
}
public function up(Schema $schema): void
{
$this->addSql('ALTER TABLE campaign CHANGE hide_audio hide_audio TINYINT(1) DEFAULT 0 NOT NULL');
$this->addSql('DROP INDEX code ON country_phone_code');
$this->addSql('ALTER TABLE creator CHANGE last_notifications last_notifications JSON DEFAULT (JSON_ARRAY()) NOT NULL, CHANGE birthday birthday DATE NOT NULL, CHANGE vip vip TINYINT(1) NOT NULL, CHANGE dark_theme dark_theme TINYINT(1) NOT NULL, CHANGE updates updates JSON DEFAULT (JSON_OBJECT()) NOT NULL');
$this->addSql('ALTER TABLE notification RENAME INDEX uniq_88ebe88ea76ed395 TO UNIQ_BF5476CAA76ED395');
$this->addSql('ALTER TABLE payment_method DROP FOREIGN KEY FK_7B61A1F6A76ED395');
$this->addSql('ALTER TABLE payment_method ADD CONSTRAINT FK_7B61A1F6A76ED395 FOREIGN KEY (user_id) REFERENCES user (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE settings CHANGE max_video_check_retries max_video_check_retries SMALLINT NOT NULL');
$this->addSql('ALTER TABLE tik_tok_auth CHANGE refreshed_at refreshed_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP NOT NULL');
}
public function down(Schema $schema): void
{
$this->addSql('ALTER TABLE campaign CHANGE hide_audio hide_audio TINYINT(1) DEFAULT 1 NOT NULL');
$this->addSql('CREATE INDEX code ON country_phone_code (code)');
$this->addSql('ALTER TABLE creator CHANGE birthday birthday DATE DEFAULT NULL, CHANGE vip vip TINYINT(1) DEFAULT 0 NOT NULL, CHANGE dark_theme dark_theme TINYINT(1) DEFAULT 0 NOT NULL, CHANGE last_notifications last_notifications JSON DEFAULT \'json_array()\' NOT NULL, CHANGE updates updates JSON DEFAULT \'json_object()\' NOT NULL');
$this->addSql('ALTER TABLE notification RENAME INDEX uniq_bf5476caa76ed395 TO UNIQ_88EBE88EA76ED395');
$this->addSql('ALTER TABLE payment_method DROP FOREIGN KEY FK_7B61A1F6A76ED395');
$this->addSql('ALTER TABLE payment_method ADD CONSTRAINT FK_7B61A1F6A76ED395 FOREIGN KEY (user_id) REFERENCES user (id) ON UPDATE NO ACTION ON DELETE NO ACTION');
$this->addSql('ALTER TABLE settings CHANGE max_video_check_retries max_video_check_retries SMALLINT DEFAULT 3 NOT NULL');
$this->addSql('ALTER TABLE tik_tok_auth CHANGE refreshed_at refreshed_at DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL');
}
public function isTransactional(): bool
{
return false;
}
}