<?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 Version20211021150651 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('CREATE TABLE target_url (id INT AUTO_INCREMENT NOT NULL, client_id INT DEFAULT NULL, campaign_id INT DEFAULT NULL, url VARCHAR(255) NOT NULL, slug VARCHAR(255) NOT NULL, INDEX IDX_3B66675B19EB6921 (client_id), INDEX IDX_3B66675BF639F774 (campaign_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE target_url ADD CONSTRAINT FK_3B66675B19EB6921 FOREIGN KEY (client_id) REFERENCES client (id)');
$this->addSql('ALTER TABLE target_url ADD CONSTRAINT FK_3B66675BF639F774 FOREIGN KEY (campaign_id) REFERENCES campaign (id)');
$this->addSql('ALTER TABLE answer ADD client_id INT DEFAULT NULL, ADD campaign_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE answer ADD CONSTRAINT FK_DADD4A2519EB6921 FOREIGN KEY (client_id) REFERENCES client (id)');
$this->addSql('ALTER TABLE answer ADD CONSTRAINT FK_DADD4A25F639F774 FOREIGN KEY (campaign_id) REFERENCES campaign (id)');
$this->addSql('CREATE INDEX IDX_DADD4A2519EB6921 ON answer (client_id)');
$this->addSql('CREATE INDEX IDX_DADD4A25F639F774 ON answer (campaign_id)');
$this->addSql('ALTER TABLE campaign ADD clicked INT NOT NULL, ADD content LONGTEXT NOT NULL, ADD content_json LONGTEXT NOT NULL, ADD status VARCHAR(255) NOT NULL, ADD sent_emails JSON DEFAULT NULL');
$this->addSql('ALTER TABLE client ADD confirmation_token VARCHAR(255) DEFAULT NULL, ADD request_at DATETIME DEFAULT NULL, CHANGE firstname firstname VARCHAR(255) NOT NULL, CHANGE lastname lastname VARCHAR(255) NOT NULL, CHANGE old_id old_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE email_template CHANGE hotel_id hotel_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE hotel ADD slug VARCHAR(255) NOT NULL');
$this->addSql('ALTER TABLE stay ADD notifications JSON DEFAULT NULL');
$this->addSql('ALTER TABLE survey ADD slug VARCHAR(255) NOT NULL');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('DROP TABLE target_url');
$this->addSql('ALTER TABLE answer DROP FOREIGN KEY FK_DADD4A2519EB6921');
$this->addSql('ALTER TABLE answer DROP FOREIGN KEY FK_DADD4A25F639F774');
$this->addSql('DROP INDEX IDX_DADD4A2519EB6921 ON answer');
$this->addSql('DROP INDEX IDX_DADD4A25F639F774 ON answer');
$this->addSql('ALTER TABLE answer DROP client_id, DROP campaign_id');
$this->addSql('ALTER TABLE campaign DROP clicked, DROP content, DROP content_json, DROP status, DROP sent_emails');
$this->addSql('ALTER TABLE client DROP confirmation_token, DROP request_at, CHANGE firstname firstname VARCHAR(255) CHARACTER SET utf8mb4 DEFAULT NULL COLLATE `utf8mb4_unicode_ci`, CHANGE lastname lastname VARCHAR(255) CHARACTER SET utf8mb4 DEFAULT NULL COLLATE `utf8mb4_unicode_ci`, CHANGE old_id old_id INT NOT NULL');
$this->addSql('ALTER TABLE email_template CHANGE hotel_id hotel_id INT NOT NULL');
$this->addSql('ALTER TABLE hotel DROP slug');
$this->addSql('ALTER TABLE stay DROP notifications');
$this->addSql('ALTER TABLE survey DROP slug');
}
}