<?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 Version20220429103607 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 email (id INT AUTO_INCREMENT NOT NULL, subject VARCHAR(255) NOT NULL, body LONGTEXT NOT NULL, from_name VARCHAR(255) DEFAULT NULL, add_to LONGTEXT DEFAULT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE email_email_attachment (email_id INT NOT NULL, email_attachment_id INT NOT NULL, INDEX IDX_DBD5C3D3A832C1C9 (email_id), INDEX IDX_DBD5C3D3F653F523 (email_attachment_id), PRIMARY KEY(email_id, email_attachment_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE email_attachment (id INT AUTO_INCREMENT NOT NULL, name VARCHAR(255) NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE email_email_attachment ADD CONSTRAINT FK_DBD5C3D3A832C1C9 FOREIGN KEY (email_id) REFERENCES email (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE email_email_attachment ADD CONSTRAINT FK_DBD5C3D3F653F523 FOREIGN KEY (email_attachment_id) REFERENCES email_attachment (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE action DROP params');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE email_email_attachment DROP FOREIGN KEY FK_DBD5C3D3A832C1C9');
$this->addSql('ALTER TABLE email_email_attachment DROP FOREIGN KEY FK_DBD5C3D3F653F523');
$this->addSql('DROP TABLE email');
$this->addSql('DROP TABLE email_email_attachment');
$this->addSql('DROP TABLE email_attachment');
$this->addSql('ALTER TABLE action ADD params JSON DEFAULT NULL');
}
}