<?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 Version20220414110059 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_log (id INT AUTO_INCREMENT NOT NULL, title VARCHAR(250) NOT NULL, body LONGTEXT NOT NULL, destination VARCHAR(255) NOT NULL, status SMALLINT DEFAULT 0 NOT NULL, date_added DATETIME NOT NULL, date_send DATETIME DEFAULT NULL, text LONGTEXT NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE email_template (id INT AUTO_INCREMENT NOT NULL, header_id INT DEFAULT NULL, footer_id INT DEFAULT NULL, email_trigger_id INT DEFAULT NULL, title VARCHAR(250) NOT NULL, body LONGTEXT NOT NULL, type INT NOT NULL, status TINYINT(1) DEFAULT 1 NOT NULL, date_added DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, date_modified DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, INDEX IDX_9C0600CA2EF91FD8 (header_id), INDEX IDX_9C0600CA2412A144 (footer_id), INDEX IDX_9C0600CAF36E2E09 (email_trigger_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE email_trigger (id INT AUTO_INCREMENT NOT NULL, name VARCHAR(50) NOT NULL, status TINYINT(1) DEFAULT 1 NOT NULL, date_added DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, date_modified DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE package (id INT AUTO_INCREMENT NOT NULL, name VARCHAR(50) NOT NULL, description LONGTEXT DEFAULT NULL, status TINYINT(1) DEFAULT 1 NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE participant (id INT UNSIGNED AUTO_INCREMENT NOT NULL, package_id INT NOT NULL, name VARCHAR(255) NOT NULL, company VARCHAR(255) DEFAULT NULL, email VARCHAR(255) DEFAULT NULL, phone VARCHAR(255) DEFAULT NULL, print_date DATETIME DEFAULT NULL, status INT NOT NULL, modified_at DATETIME NOT NULL, secret_code CHAR(36) NOT NULL COMMENT \'(DC2Type:guid)\', qr_sent DATETIME DEFAULT NULL, INDEX IDX_D79F6B11F44CABFF (package_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE role (id INT UNSIGNED AUTO_INCREMENT NOT NULL, name VARCHAR(50) NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE `setting` (id INT AUTO_INCREMENT NOT NULL, name VARCHAR(50) NOT NULL, value VARCHAR(255) NOT NULL, translation_key VARCHAR(25) NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE user (id INT UNSIGNED AUTO_INCREMENT NOT NULL, email VARCHAR(100) NOT NULL, password VARCHAR(255) NOT NULL, name VARCHAR(255) NOT NULL, token VARCHAR(50) DEFAULT NULL, status INT DEFAULT 1 NOT NULL, date_added DATETIME DEFAULT NULL, date_modified DATETIME DEFAULT NULL, INDEX status (status), UNIQUE INDEX email (email), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE user_role (user_id INT UNSIGNED NOT NULL, role_id INT UNSIGNED NOT NULL, INDEX IDX_2DE8C6A3A76ED395 (user_id), INDEX IDX_2DE8C6A3D60322AC (role_id), PRIMARY KEY(user_id, role_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE email_template ADD CONSTRAINT FK_9C0600CA2EF91FD8 FOREIGN KEY (header_id) REFERENCES email_template (id)');
$this->addSql('ALTER TABLE email_template ADD CONSTRAINT FK_9C0600CA2412A144 FOREIGN KEY (footer_id) REFERENCES email_template (id)');
$this->addSql('ALTER TABLE email_template ADD CONSTRAINT FK_9C0600CAF36E2E09 FOREIGN KEY (email_trigger_id) REFERENCES email_trigger (id)');
$this->addSql('ALTER TABLE participant ADD CONSTRAINT FK_D79F6B11F44CABFF FOREIGN KEY (package_id) REFERENCES package (id)');
$this->addSql('ALTER TABLE user_role ADD CONSTRAINT FK_2DE8C6A3A76ED395 FOREIGN KEY (user_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE user_role ADD CONSTRAINT FK_2DE8C6A3D60322AC FOREIGN KEY (role_id) REFERENCES role (id)');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE email_template DROP FOREIGN KEY FK_9C0600CA2EF91FD8');
$this->addSql('ALTER TABLE email_template DROP FOREIGN KEY FK_9C0600CA2412A144');
$this->addSql('ALTER TABLE email_template DROP FOREIGN KEY FK_9C0600CAF36E2E09');
$this->addSql('ALTER TABLE participant DROP FOREIGN KEY FK_D79F6B11F44CABFF');
$this->addSql('ALTER TABLE user_role DROP FOREIGN KEY FK_2DE8C6A3D60322AC');
$this->addSql('ALTER TABLE user_role DROP FOREIGN KEY FK_2DE8C6A3A76ED395');
$this->addSql('DROP TABLE email_log');
$this->addSql('DROP TABLE email_template');
$this->addSql('DROP TABLE email_trigger');
$this->addSql('DROP TABLE package');
$this->addSql('DROP TABLE participant');
$this->addSql('DROP TABLE role');
$this->addSql('DROP TABLE `setting`');
$this->addSql('DROP TABLE user');
$this->addSql('DROP TABLE user_role');
}
}