src/Migrations/Version20201119140511.php line 1
<?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 Version20201119140511 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 organisation_success_history (id INT AUTO_INCREMENT NOT NULL, photo_id INT DEFAULT NULL, organisation_id INT NOT NULL, created_by_id INT DEFAULT NULL, updated_by_id INT DEFAULT NULL, surname VARCHAR(255) DEFAULT NULL, firstname VARCHAR(255) DEFAULT NULL, fathername VARCHAR(255) DEFAULT NULL, history LONGTEXT DEFAULT NULL, deleted TINYINT(1) DEFAULT \'0\' NOT NULL, created_at DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, updated_at DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, active TINYINT(1) DEFAULT \'1\' NOT NULL, INDEX IDX_7D3B61C97E9E4C8C (photo_id), INDEX IDX_7D3B61C99E6B1585 (organisation_id), INDEX IDX_7D3B61C9B03A8386 (created_by_id), INDEX IDX_7D3B61C9896DBBDE (updated_by_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE organisation_success_history_olympiad_relation (success_history_id INT NOT NULL, olympiad_id INT NOT NULL, INDEX IDX_C0694AAFDD78D5BB (success_history_id), INDEX IDX_C0694AAF3E1B5B3A (olympiad_id), PRIMARY KEY(success_history_id, olympiad_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE scholar_olympiad_relation (profile_id INT NOT NULL, olympiad_id INT NOT NULL, INDEX IDX_6A81409FCCFA12B8 (profile_id), INDEX IDX_6A81409F3E1B5B3A (olympiad_id), PRIMARY KEY(profile_id, olympiad_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE scholar_discipline_relation (profile_id INT NOT NULL, discipline_id INT NOT NULL, INDEX IDX_A132238ECCFA12B8 (profile_id), INDEX IDX_A132238EA5522701 (discipline_id), PRIMARY KEY(profile_id, discipline_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE subscribe_subscriber (id INT AUTO_INCREMENT NOT NULL, user_id INT NOT NULL, subscription_id INT NOT NULL, active TINYINT(1) DEFAULT \'1\' NOT NULL, INDEX IDX_1B81DB06A76ED395 (user_id), INDEX IDX_1B81DB069A1887DC (subscription_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE subscribe_subscription (id INT AUTO_INCREMENT NOT NULL, created_by_id INT DEFAULT NULL, updated_by_id INT DEFAULT NULL, caption VARCHAR(255) NOT NULL, slug VARCHAR(255) NOT NULL, deleted TINYINT(1) DEFAULT \'0\' NOT NULL, created_at DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, updated_at DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, active TINYINT(1) DEFAULT \'1\' NOT NULL, INDEX IDX_AC1B261AB03A8386 (created_by_id), INDEX IDX_AC1B261A896DBBDE (updated_by_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE organisation_success_history ADD CONSTRAINT FK_7D3B61C97E9E4C8C FOREIGN KEY (photo_id) REFERENCES files (id)');
$this->addSql('ALTER TABLE organisation_success_history ADD CONSTRAINT FK_7D3B61C99E6B1585 FOREIGN KEY (organisation_id) REFERENCES organisation (id)');
$this->addSql('ALTER TABLE organisation_success_history ADD CONSTRAINT FK_7D3B61C9B03A8386 FOREIGN KEY (created_by_id) REFERENCES users (id)');
$this->addSql('ALTER TABLE organisation_success_history ADD CONSTRAINT FK_7D3B61C9896DBBDE FOREIGN KEY (updated_by_id) REFERENCES users (id)');
$this->addSql('ALTER TABLE organisation_success_history_olympiad_relation ADD CONSTRAINT FK_C0694AAFDD78D5BB FOREIGN KEY (success_history_id) REFERENCES organisation_success_history (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE organisation_success_history_olympiad_relation ADD CONSTRAINT FK_C0694AAF3E1B5B3A FOREIGN KEY (olympiad_id) REFERENCES olympiad (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE scholar_olympiad_relation ADD CONSTRAINT FK_6A81409FCCFA12B8 FOREIGN KEY (profile_id) REFERENCES scholar_profile (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE scholar_olympiad_relation ADD CONSTRAINT FK_6A81409F3E1B5B3A FOREIGN KEY (olympiad_id) REFERENCES olympiad (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE scholar_discipline_relation ADD CONSTRAINT FK_A132238ECCFA12B8 FOREIGN KEY (profile_id) REFERENCES scholar_profile (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE scholar_discipline_relation ADD CONSTRAINT FK_A132238EA5522701 FOREIGN KEY (discipline_id) REFERENCES olympiad_discipline (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE subscribe_subscriber ADD CONSTRAINT FK_1B81DB06A76ED395 FOREIGN KEY (user_id) REFERENCES users (id)');
$this->addSql('ALTER TABLE subscribe_subscriber ADD CONSTRAINT FK_1B81DB069A1887DC FOREIGN KEY (subscription_id) REFERENCES subscribe_subscription (id)');
$this->addSql('ALTER TABLE subscribe_subscription ADD CONSTRAINT FK_AC1B261AB03A8386 FOREIGN KEY (created_by_id) REFERENCES users (id)');
$this->addSql('ALTER TABLE subscribe_subscription ADD CONSTRAINT FK_AC1B261A896DBBDE FOREIGN KEY (updated_by_id) REFERENCES users (id)');
$this->addSql('ALTER TABLE scholar_profile ADD about LONGTEXT DEFAULT NULL');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE organisation_success_history_olympiad_relation DROP FOREIGN KEY FK_C0694AAFDD78D5BB');
$this->addSql('ALTER TABLE subscribe_subscriber DROP FOREIGN KEY FK_1B81DB069A1887DC');
$this->addSql('DROP TABLE organisation_success_history');
$this->addSql('DROP TABLE organisation_success_history_olympiad_relation');
$this->addSql('DROP TABLE scholar_olympiad_relation');
$this->addSql('DROP TABLE scholar_discipline_relation');
$this->addSql('DROP TABLE subscribe_subscriber');
$this->addSql('DROP TABLE subscribe_subscription');
$this->addSql('ALTER TABLE scholar_profile DROP about');
}
}