<?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 Version20220427021657 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 company (id INT AUTO_INCREMENT NOT NULL, company_title VARCHAR(255) NOT NULL, is_active TINYINT(1) DEFAULT 1 NOT NULL, is_deleted TINYINT(1) NOT NULL, created_at DATETIME DEFAULT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE company_settings (id INT AUTO_INCREMENT NOT NULL, company_id INT DEFAULT NULL, system_language VARCHAR(10) NOT NULL, datetime_format VARCHAR(255) DEFAULT NULL, INDEX company_id (company_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE company_terminology (id INT AUTO_INCREMENT NOT NULL, company_id INT DEFAULT NULL, terminology_id INT DEFAULT NULL, singular_text VARCHAR(255) NOT NULL, plural_text VARCHAR(255) NOT NULL, INDEX company_id (company_id), UNIQUE INDEX terminology_id (terminology_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE company_user (id INT AUTO_INCREMENT NOT NULL, user_id INT DEFAULT NULL, is_main_user TINYINT(1) NOT NULL, is_default_company TINYINT(1) DEFAULT 1 NOT NULL, assigned_date DATETIME DEFAULT NULL, INDEX recruiter_id (user_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE login_sessions (id INT AUTO_INCREMENT NOT NULL, user_id INT DEFAULT NULL, location VARCHAR(255) DEFAULT NULL, device VARCHAR(255) DEFAULT NULL, ip_address VARCHAR(255) DEFAULT NULL, action VARCHAR(255) NOT NULL, action_time DATETIME DEFAULT NULL, INDEX user_id (user_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE reset_password_request (id INT AUTO_INCREMENT NOT NULL, user_id INT NOT NULL, selector VARCHAR(20) NOT NULL, hashed_token VARCHAR(100) NOT NULL, requested_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', expires_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', INDEX IDX_7CE748AA76ED395 (user_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE tc_countries (id INT AUTO_INCREMENT NOT NULL, country_code VARCHAR(255) NOT NULL, country VARCHAR(255) NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE tc_languages (id INT AUTO_INCREMENT NOT NULL, language_code VARCHAR(50) NOT NULL, language VARCHAR(255) NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE tc_mail_log (id INT AUTO_INCREMENT NOT NULL, user_id INT DEFAULT NULL, email VARCHAR(255) NOT NULL, mail_type VARCHAR(255) DEFAULT NULL, is_sent TINYINT(1) NOT NULL, sent_at DATETIME DEFAULT NULL, is_opened TINYINT(1) NOT NULL, opened_at DATETIME DEFAULT NULL, is_bounced TINYINT(1) NOT NULL, bounced_at DATETIME DEFAULT NULL, is_resent TINYINT(1) NOT NULL, resent_at DATETIME DEFAULT NULL, resent_count INT NOT NULL, INDEX user_id (user_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE tc_mail_spool (id INT AUTO_INCREMENT NOT NULL, mail_log_id INT DEFAULT NULL, email VARCHAR(255) NOT NULL, subject VARCHAR(255) NOT NULL, mail_content MEDIUMTEXT NOT NULL, is_ready TINYINT(1) NOT NULL, is_cron TINYINT(1) NOT NULL, INDEX mail_log_id (mail_log_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE terminology (id INT AUTO_INCREMENT NOT NULL, terminology_key VARCHAR(255) NOT NULL, singular_text VARCHAR(255) DEFAULT NULL, plural_text VARCHAR(255) DEFAULT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE user (id INT AUTO_INCREMENT NOT NULL, created_by INT DEFAULT NULL, deleted_by INT DEFAULT NULL, updated_by INT DEFAULT NULL, email VARCHAR(180) NOT NULL, roles LONGTEXT NOT NULL COMMENT \'(DC2Type:json)\', password VARCHAR(255) NOT NULL, is_verified TINYINT(1) NOT NULL, is_active TINYINT(1) DEFAULT NULL, created_method VARCHAR(255) DEFAULT \'self\' NOT NULL, created_at DATETIME DEFAULT NULL, updated_at DATETIME DEFAULT NULL, deleted_at DATETIME DEFAULT NULL, is_deleted TINYINT(1) DEFAULT NULL, UNIQUE INDEX UNIQ_8D93D649E7927C74 (email), INDEX updated_by (updated_by), INDEX deleted_by (deleted_by), INDEX created_by (created_by), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE user_group (id INT AUTO_INCREMENT NOT NULL, user_group VARCHAR(255) NOT NULL, is_active INT NOT NULL, is_deleted INT NOT NULL, created_at DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE user_profile (id INT AUTO_INCREMENT NOT NULL, user_id INT DEFAULT NULL, first_name VARCHAR(255) DEFAULT NULL, last_name VARCHAR(255) DEFAULT NULL, user_profile_image TEXT DEFAULT NULL, phone VARCHAR(255) DEFAULT NULL, company_name VARCHAR(255) DEFAULT NULL, company_phone VARCHAR(255) DEFAULT NULL, language VARCHAR(255) DEFAULT NULL, company_address VARCHAR(255) DEFAULT NULL, town VARCHAR(255) DEFAULT NULL, state VARCHAR(255) DEFAULT NULL, country VARCHAR(255) DEFAULT NULL, postcode VARCHAR(255) DEFAULT NULL, INDEX user_id (user_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE company_settings ADD CONSTRAINT FK_FDD2B5A8979B1AD6 FOREIGN KEY (company_id) REFERENCES company (id)');
$this->addSql('ALTER TABLE company_terminology ADD CONSTRAINT FK_9874CED6979B1AD6 FOREIGN KEY (company_id) REFERENCES company (id)');
$this->addSql('ALTER TABLE company_terminology ADD CONSTRAINT FK_9874CED6C39CEC6C FOREIGN KEY (terminology_id) REFERENCES terminology (id)');
$this->addSql('ALTER TABLE company_user ADD CONSTRAINT FK_CEFECCA7A76ED395 FOREIGN KEY (user_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE login_sessions ADD CONSTRAINT FK_B4C4BD8CA76ED395 FOREIGN KEY (user_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE reset_password_request ADD CONSTRAINT FK_7CE748AA76ED395 FOREIGN KEY (user_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE tc_mail_log ADD CONSTRAINT FK_4441398FA76ED395 FOREIGN KEY (user_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE tc_mail_spool ADD CONSTRAINT FK_E07F160B375EE2ED FOREIGN KEY (mail_log_id) REFERENCES tc_mail_log (id)');
$this->addSql('ALTER TABLE user ADD CONSTRAINT FK_8D93D649DE12AB56 FOREIGN KEY (created_by) REFERENCES user (id)');
$this->addSql('ALTER TABLE user ADD CONSTRAINT FK_8D93D6491F6FA0AF FOREIGN KEY (deleted_by) REFERENCES user (id)');
$this->addSql('ALTER TABLE user ADD CONSTRAINT FK_8D93D64916FE72E1 FOREIGN KEY (updated_by) REFERENCES user (id)');
$this->addSql('ALTER TABLE user_profile ADD CONSTRAINT FK_D95AB405A76ED395 FOREIGN KEY (user_id) REFERENCES user (id)');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE company_settings DROP FOREIGN KEY FK_FDD2B5A8979B1AD6');
$this->addSql('ALTER TABLE company_terminology DROP FOREIGN KEY FK_9874CED6979B1AD6');
$this->addSql('ALTER TABLE tc_mail_spool DROP FOREIGN KEY FK_E07F160B375EE2ED');
$this->addSql('ALTER TABLE company_terminology DROP FOREIGN KEY FK_9874CED6C39CEC6C');
$this->addSql('ALTER TABLE company_user DROP FOREIGN KEY FK_CEFECCA7A76ED395');
$this->addSql('ALTER TABLE login_sessions DROP FOREIGN KEY FK_B4C4BD8CA76ED395');
$this->addSql('ALTER TABLE reset_password_request DROP FOREIGN KEY FK_7CE748AA76ED395');
$this->addSql('ALTER TABLE tc_mail_log DROP FOREIGN KEY FK_4441398FA76ED395');
$this->addSql('ALTER TABLE user DROP FOREIGN KEY FK_8D93D649DE12AB56');
$this->addSql('ALTER TABLE user DROP FOREIGN KEY FK_8D93D6491F6FA0AF');
$this->addSql('ALTER TABLE user DROP FOREIGN KEY FK_8D93D64916FE72E1');
$this->addSql('ALTER TABLE user_profile DROP FOREIGN KEY FK_D95AB405A76ED395');
$this->addSql('DROP TABLE company');
$this->addSql('DROP TABLE company_settings');
$this->addSql('DROP TABLE company_terminology');
$this->addSql('DROP TABLE company_user');
$this->addSql('DROP TABLE login_sessions');
$this->addSql('DROP TABLE reset_password_request');
$this->addSql('DROP TABLE tc_countries');
$this->addSql('DROP TABLE tc_languages');
$this->addSql('DROP TABLE tc_mail_log');
$this->addSql('DROP TABLE tc_mail_spool');
$this->addSql('DROP TABLE terminology');
$this->addSql('DROP TABLE user');
$this->addSql('DROP TABLE user_group');
$this->addSql('DROP TABLE user_profile');
}
}