src/Migrations/Version20200903073318.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 Version20200903073318 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->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');
$this->addSql('CREATE TABLE contacts (id INT AUTO_INCREMENT NOT NULL, created_by_id INT DEFAULT NULL, updated_by_id INT DEFAULT NULL, type VARCHAR(255) DEFAULT NULL, caption VARCHAR(255) NOT NULL, value 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, owner_type VARCHAR(50) DEFAULT NULL, owner_id INT DEFAULT NULL, INDEX IDX_33401573B03A8386 (created_by_id), INDEX IDX_33401573896DBBDE (updated_by_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE files (id INT AUTO_INCREMENT NOT NULL, created_by_id INT DEFAULT NULL, created_at DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, data_name VARCHAR(255) DEFAULT NULL, data_original_name VARCHAR(255) DEFAULT NULL, data_mime_type VARCHAR(255) DEFAULT NULL, data_dimensions JSON DEFAULT NULL, data_size BIGINT DEFAULT NULL, owner_type VARCHAR(50) DEFAULT NULL, owner_id INT DEFAULT NULL, INDEX IDX_6354059B03A8386 (created_by_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE links (id INT AUTO_INCREMENT NOT NULL, created_by_id INT DEFAULT NULL, updated_by_id INT DEFAULT NULL, caption VARCHAR(255) NOT NULL, url 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, owner_type VARCHAR(50) DEFAULT NULL, owner_id INT DEFAULT NULL, INDEX IDX_D182A118B03A8386 (created_by_id), INDEX IDX_D182A118896DBBDE (updated_by_id), INDEX idx_relation (owner_type, owner_id, deleted), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE reviews (id INT AUTO_INCREMENT NOT NULL, user_id INT DEFAULT NULL, rating SMALLINT NOT NULL, text LONGTEXT NOT NULL, owner_type VARCHAR(50) DEFAULT NULL, owner_id INT DEFAULT NULL, INDEX IDX_6970EB0FA76ED395 (user_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE news (id INT AUTO_INCREMENT NOT NULL, image_id INT DEFAULT NULL, type_id INT NOT NULL, created_by_id INT DEFAULT NULL, updated_by_id INT DEFAULT NULL, caption VARCHAR(255) NOT NULL, subtitle VARCHAR(250) DEFAULT NULL, preview LONGTEXT DEFAULT NULL, text LONGTEXT DEFAULT NULL, published TINYINT(1) NOT NULL, publish_at DATETIME DEFAULT NULL, pinned TINYINT(1) 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, owner_type VARCHAR(50) DEFAULT NULL, owner_id INT DEFAULT NULL, interval_from DATE DEFAULT NULL, interval_to DATE DEFAULT NULL, INDEX IDX_1DD399503DA5256D (image_id), INDEX IDX_1DD39950C54C8C93 (type_id), INDEX IDX_1DD39950B03A8386 (created_by_id), INDEX IDX_1DD39950896DBBDE (updated_by_id), INDEX idx_active (published, pinned, publish_at), INDEX idx_deleted (deleted), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE news_type (id INT AUTO_INCREMENT NOT NULL, caption VARCHAR(255) NOT NULL, slug VARCHAR(255) NOT NULL, type VARCHAR(10) NOT NULL, deleted TINYINT(1) DEFAULT \'0\' NOT NULL, active TINYINT(1) NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE static_page (id INT AUTO_INCREMENT NOT NULL, created_by_id INT DEFAULT NULL, updated_by_id INT DEFAULT NULL, url VARCHAR(100) NOT NULL, caption VARCHAR(255) NOT NULL, content LONGTEXT DEFAULT NULL, internal TINYINT(1) 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) NOT NULL, INDEX IDX_8FA4EF95B03A8386 (created_by_id), INDEX IDX_8FA4EF95896DBBDE (updated_by_id), INDEX idx_url (url), INDEX idx_active (deleted, active), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE forum_post (id INT AUTO_INCREMENT NOT NULL, thread_id INT NOT NULL, created_by_id INT DEFAULT NULL, updated_by_id INT DEFAULT NULL, text 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, INDEX IDX_996BCC5AE2904019 (thread_id), INDEX IDX_996BCC5AB03A8386 (created_by_id), INDEX IDX_996BCC5A896DBBDE (updated_by_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE forum_thread (id INT AUTO_INCREMENT NOT NULL, last_message_id INT DEFAULT NULL, created_by_id INT DEFAULT NULL, updated_by_id INT DEFAULT NULL, caption 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, owner_type VARCHAR(50) DEFAULT NULL, owner_id INT DEFAULT NULL, INDEX IDX_298F7F52BA0E79C3 (last_message_id), INDEX IDX_298F7F52B03A8386 (created_by_id), INDEX IDX_298F7F52896DBBDE (updated_by_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE olympiad_category (id INT AUTO_INCREMENT NOT NULL, created_by_id INT DEFAULT NULL, caption VARCHAR(255) NOT NULL, slug VARCHAR(150) NOT NULL, active TINYINT(1) NOT NULL, created_at DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, deleted TINYINT(1) DEFAULT \'0\' NOT NULL, INDEX IDX_213E7678B03A8386 (created_by_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE olympiad_discipline (id INT AUTO_INCREMENT NOT NULL, category_id INT NOT NULL, created_by_id INT DEFAULT NULL, caption VARCHAR(255) NOT NULL, active TINYINT(1) NOT NULL, created_at DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, deleted TINYINT(1) DEFAULT \'0\' NOT NULL, INDEX IDX_9DB4A07512469DE2 (category_id), INDEX IDX_9DB4A075B03A8386 (created_by_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE olympiad_grade (id INT AUTO_INCREMENT NOT NULL, created_by_id INT DEFAULT NULL, updated_by_id INT DEFAULT NULL, value VARCHAR(255) NOT NULL, caption 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) NOT NULL, INDEX IDX_BA89D858B03A8386 (created_by_id), INDEX IDX_BA89D858896DBBDE (updated_by_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE olympiad_level (id INT AUTO_INCREMENT NOT NULL, created_by_id INT DEFAULT NULL, caption VARCHAR(255) NOT NULL, slug VARCHAR(150) NOT NULL, active TINYINT(1) NOT NULL, created_at DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, deleted TINYINT(1) DEFAULT \'0\' NOT NULL, INDEX IDX_7939BA7FB03A8386 (created_by_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE olympiad (id INT AUTO_INCREMENT NOT NULL, level_id INT NOT NULL, organisation_id INT DEFAULT NULL, logo_id INT DEFAULT NULL, created_by_id INT DEFAULT NULL, updated_by_id INT DEFAULT NULL, caption VARCHAR(255) NOT NULL, description LONGTEXT DEFAULT NULL, results 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) NOT NULL, interval_from DATE DEFAULT NULL, interval_to DATE DEFAULT NULL, INDEX IDX_77700B8E5FB14BA7 (level_id), INDEX IDX_77700B8E9E6B1585 (organisation_id), INDEX IDX_77700B8EF98F144A (logo_id), INDEX IDX_77700B8EB03A8386 (created_by_id), INDEX IDX_77700B8E896DBBDE (updated_by_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE olympiad_discipline_relation (olympiad_id INT NOT NULL, discipline_id INT NOT NULL, INDEX IDX_29F20D113E1B5B3A (olympiad_id), INDEX IDX_29F20D11A5522701 (discipline_id), PRIMARY KEY(olympiad_id, discipline_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE olympiad_grade_relation (olympiad_id INT NOT NULL, grade_id INT NOT NULL, INDEX IDX_F6E413DC3E1B5B3A (olympiad_id), INDEX IDX_F6E413DCFE19A1A8 (grade_id), PRIMARY KEY(olympiad_id, grade_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE olympiad_stage (id INT AUTO_INCREMENT NOT NULL, olympiad_id INT NOT NULL, created_by_id INT DEFAULT NULL, updated_by_id INT DEFAULT NULL, caption VARCHAR(255) NOT NULL, description LONGTEXT DEFAULT NULL, place LONGTEXT DEFAULT NULL, contacts 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) NOT NULL, interval_from DATE DEFAULT NULL, interval_to DATE DEFAULT NULL, INDEX IDX_21AFE5053E1B5B3A (olympiad_id), INDEX IDX_21AFE505B03A8386 (created_by_id), INDEX IDX_21AFE505896DBBDE (updated_by_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE organisation (id INT AUTO_INCREMENT NOT NULL, parent_id INT DEFAULT NULL, type_id INT NOT NULL, logo_id INT DEFAULT NULL, created_by_id INT DEFAULT NULL, updated_by_id INT DEFAULT NULL, caption VARCHAR(255) NOT NULL, description 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) NOT NULL, INDEX IDX_E6E132B4727ACA70 (parent_id), INDEX IDX_E6E132B4C54C8C93 (type_id), INDEX IDX_E6E132B4F98F144A (logo_id), INDEX IDX_E6E132B4B03A8386 (created_by_id), INDEX IDX_E6E132B4896DBBDE (updated_by_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE organisation_page (id INT AUTO_INCREMENT NOT NULL, organisation_id INT NOT NULL, page_type_id INT DEFAULT NULL, created_by_id INT DEFAULT NULL, updated_by_id INT DEFAULT NULL, slug VARCHAR(100) NOT NULL, caption VARCHAR(255) NOT NULL, content LONGTEXT DEFAULT NULL, weight INT 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) NOT NULL, INDEX IDX_564EB6389E6B1585 (organisation_id), INDEX IDX_564EB6383F2C6706 (page_type_id), INDEX IDX_564EB638B03A8386 (created_by_id), INDEX IDX_564EB638896DBBDE (updated_by_id), INDEX idx_url (slug), INDEX idx_active (active), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE organisation_page_type (id INT AUTO_INCREMENT NOT NULL, type_id INT NOT NULL, created_by_id INT DEFAULT NULL, caption VARCHAR(255) NOT NULL, slug VARCHAR(150) NOT NULL, content LONGTEXT DEFAULT NULL, weight INT NOT NULL, active TINYINT(1) NOT NULL, created_at DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, deleted TINYINT(1) DEFAULT \'0\' NOT NULL, INDEX IDX_EE569F2BC54C8C93 (type_id), INDEX IDX_EE569F2BB03A8386 (created_by_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE organisation_type (id INT AUTO_INCREMENT NOT NULL, slug VARCHAR(255) NOT NULL, caption VARCHAR(255) NOT NULL, is_active TINYINT(1) NOT NULL, deleted TINYINT(1) DEFAULT \'0\' NOT NULL, INDEX idx_active (is_active, deleted), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE organisation_user (id INT AUTO_INCREMENT NOT NULL, organisation_id INT NOT NULL, user_id INT NOT NULL, type VARCHAR(255) NOT NULL, INDEX IDX_CFD7D6519E6B1585 (organisation_id), INDEX IDX_CFD7D651A76ED395 (user_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE user_password_recovery (id INT AUTO_INCREMENT NOT NULL, user_id INT NOT NULL, token VARCHAR(100) NOT NULL, used TINYINT(1) NOT NULL, type VARCHAR(255) NOT NULL, valid_till DATETIME NOT NULL, created_at DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, updated_at DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, UNIQUE INDEX UNIQ_9BCBBA225F37A13B (token), INDEX IDX_9BCBBA22A76ED395 (user_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE phone_confirmation (uuid VARCHAR(100) NOT NULL, code VARCHAR(10) NOT NULL, phone VARCHAR(20) NOT NULL, token VARCHAR(100) DEFAULT NULL, ip VARCHAR(40) DEFAULT NULL, created_at DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, INDEX idx_pc_limits (created_at, token, phone, ip), PRIMARY KEY(uuid)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE users (id INT AUTO_INCREMENT NOT NULL, created_by_id INT DEFAULT NULL, updated_by_id INT DEFAULT NULL, last_action_at DATETIME DEFAULT NULL, username VARCHAR(50) NOT NULL, first_name VARCHAR(255) DEFAULT NULL, middle_name VARCHAR(255) DEFAULT NULL, last_name VARCHAR(255) DEFAULT NULL, phone VARCHAR(50) DEFAULT NULL, password VARCHAR(255) NOT NULL, admin_comment LONGTEXT DEFAULT NULL, roles JSON 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) NOT NULL, UNIQUE INDEX UNIQ_1483A5E9F85E0677 (username), INDEX IDX_1483A5E9B03A8386 (created_by_id), INDEX IDX_1483A5E9896DBBDE (updated_by_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE contacts ADD CONSTRAINT FK_33401573B03A8386 FOREIGN KEY (created_by_id) REFERENCES users (id)');
$this->addSql('ALTER TABLE contacts ADD CONSTRAINT FK_33401573896DBBDE FOREIGN KEY (updated_by_id) REFERENCES users (id)');
$this->addSql('ALTER TABLE files ADD CONSTRAINT FK_6354059B03A8386 FOREIGN KEY (created_by_id) REFERENCES users (id)');
$this->addSql('ALTER TABLE links ADD CONSTRAINT FK_D182A118B03A8386 FOREIGN KEY (created_by_id) REFERENCES users (id)');
$this->addSql('ALTER TABLE links ADD CONSTRAINT FK_D182A118896DBBDE FOREIGN KEY (updated_by_id) REFERENCES users (id)');
$this->addSql('ALTER TABLE reviews ADD CONSTRAINT FK_6970EB0FA76ED395 FOREIGN KEY (user_id) REFERENCES users (id)');
$this->addSql('ALTER TABLE news ADD CONSTRAINT FK_1DD399503DA5256D FOREIGN KEY (image_id) REFERENCES files (id)');
$this->addSql('ALTER TABLE news ADD CONSTRAINT FK_1DD39950C54C8C93 FOREIGN KEY (type_id) REFERENCES news_type (id)');
$this->addSql('ALTER TABLE news ADD CONSTRAINT FK_1DD39950B03A8386 FOREIGN KEY (created_by_id) REFERENCES users (id)');
$this->addSql('ALTER TABLE news ADD CONSTRAINT FK_1DD39950896DBBDE FOREIGN KEY (updated_by_id) REFERENCES users (id)');
$this->addSql('ALTER TABLE static_page ADD CONSTRAINT FK_8FA4EF95B03A8386 FOREIGN KEY (created_by_id) REFERENCES users (id)');
$this->addSql('ALTER TABLE static_page ADD CONSTRAINT FK_8FA4EF95896DBBDE FOREIGN KEY (updated_by_id) REFERENCES users (id)');
$this->addSql('ALTER TABLE forum_post ADD CONSTRAINT FK_996BCC5AE2904019 FOREIGN KEY (thread_id) REFERENCES forum_thread (id)');
$this->addSql('ALTER TABLE forum_post ADD CONSTRAINT FK_996BCC5AB03A8386 FOREIGN KEY (created_by_id) REFERENCES users (id)');
$this->addSql('ALTER TABLE forum_post ADD CONSTRAINT FK_996BCC5A896DBBDE FOREIGN KEY (updated_by_id) REFERENCES users (id)');
$this->addSql('ALTER TABLE forum_thread ADD CONSTRAINT FK_298F7F52BA0E79C3 FOREIGN KEY (last_message_id) REFERENCES forum_post (id)');
$this->addSql('ALTER TABLE forum_thread ADD CONSTRAINT FK_298F7F52B03A8386 FOREIGN KEY (created_by_id) REFERENCES users (id)');
$this->addSql('ALTER TABLE forum_thread ADD CONSTRAINT FK_298F7F52896DBBDE FOREIGN KEY (updated_by_id) REFERENCES users (id)');
$this->addSql('ALTER TABLE olympiad_category ADD CONSTRAINT FK_213E7678B03A8386 FOREIGN KEY (created_by_id) REFERENCES users (id)');
$this->addSql('ALTER TABLE olympiad_discipline ADD CONSTRAINT FK_9DB4A07512469DE2 FOREIGN KEY (category_id) REFERENCES olympiad_category (id)');
$this->addSql('ALTER TABLE olympiad_discipline ADD CONSTRAINT FK_9DB4A075B03A8386 FOREIGN KEY (created_by_id) REFERENCES users (id)');
$this->addSql('ALTER TABLE olympiad_grade ADD CONSTRAINT FK_BA89D858B03A8386 FOREIGN KEY (created_by_id) REFERENCES users (id)');
$this->addSql('ALTER TABLE olympiad_grade ADD CONSTRAINT FK_BA89D858896DBBDE FOREIGN KEY (updated_by_id) REFERENCES users (id)');
$this->addSql('ALTER TABLE olympiad_level ADD CONSTRAINT FK_7939BA7FB03A8386 FOREIGN KEY (created_by_id) REFERENCES users (id)');
$this->addSql('ALTER TABLE olympiad ADD CONSTRAINT FK_77700B8E5FB14BA7 FOREIGN KEY (level_id) REFERENCES olympiad_level (id)');
$this->addSql('ALTER TABLE olympiad ADD CONSTRAINT FK_77700B8E9E6B1585 FOREIGN KEY (organisation_id) REFERENCES organisation (id)');
$this->addSql('ALTER TABLE olympiad ADD CONSTRAINT FK_77700B8EF98F144A FOREIGN KEY (logo_id) REFERENCES files (id)');
$this->addSql('ALTER TABLE olympiad ADD CONSTRAINT FK_77700B8EB03A8386 FOREIGN KEY (created_by_id) REFERENCES users (id)');
$this->addSql('ALTER TABLE olympiad ADD CONSTRAINT FK_77700B8E896DBBDE FOREIGN KEY (updated_by_id) REFERENCES users (id)');
$this->addSql('ALTER TABLE olympiad_discipline_relation ADD CONSTRAINT FK_29F20D113E1B5B3A FOREIGN KEY (olympiad_id) REFERENCES olympiad (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE olympiad_discipline_relation ADD CONSTRAINT FK_29F20D11A5522701 FOREIGN KEY (discipline_id) REFERENCES olympiad_discipline (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE olympiad_grade_relation ADD CONSTRAINT FK_F6E413DC3E1B5B3A FOREIGN KEY (olympiad_id) REFERENCES olympiad (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE olympiad_grade_relation ADD CONSTRAINT FK_F6E413DCFE19A1A8 FOREIGN KEY (grade_id) REFERENCES olympiad_grade (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE olympiad_stage ADD CONSTRAINT FK_21AFE5053E1B5B3A FOREIGN KEY (olympiad_id) REFERENCES olympiad (id)');
$this->addSql('ALTER TABLE olympiad_stage ADD CONSTRAINT FK_21AFE505B03A8386 FOREIGN KEY (created_by_id) REFERENCES users (id)');
$this->addSql('ALTER TABLE olympiad_stage ADD CONSTRAINT FK_21AFE505896DBBDE FOREIGN KEY (updated_by_id) REFERENCES users (id)');
$this->addSql('ALTER TABLE organisation ADD CONSTRAINT FK_E6E132B4727ACA70 FOREIGN KEY (parent_id) REFERENCES organisation (id) ON DELETE SET NULL');
$this->addSql('ALTER TABLE organisation ADD CONSTRAINT FK_E6E132B4C54C8C93 FOREIGN KEY (type_id) REFERENCES organisation_type (id)');
$this->addSql('ALTER TABLE organisation ADD CONSTRAINT FK_E6E132B4F98F144A FOREIGN KEY (logo_id) REFERENCES files (id)');
$this->addSql('ALTER TABLE organisation ADD CONSTRAINT FK_E6E132B4B03A8386 FOREIGN KEY (created_by_id) REFERENCES users (id)');
$this->addSql('ALTER TABLE organisation ADD CONSTRAINT FK_E6E132B4896DBBDE FOREIGN KEY (updated_by_id) REFERENCES users (id)');
$this->addSql('ALTER TABLE organisation_page ADD CONSTRAINT FK_564EB6389E6B1585 FOREIGN KEY (organisation_id) REFERENCES organisation (id)');
$this->addSql('ALTER TABLE organisation_page ADD CONSTRAINT FK_564EB6383F2C6706 FOREIGN KEY (page_type_id) REFERENCES organisation_page_type (id)');
$this->addSql('ALTER TABLE organisation_page ADD CONSTRAINT FK_564EB638B03A8386 FOREIGN KEY (created_by_id) REFERENCES users (id)');
$this->addSql('ALTER TABLE organisation_page ADD CONSTRAINT FK_564EB638896DBBDE FOREIGN KEY (updated_by_id) REFERENCES users (id)');
$this->addSql('ALTER TABLE organisation_page_type ADD CONSTRAINT FK_EE569F2BC54C8C93 FOREIGN KEY (type_id) REFERENCES organisation_type (id)');
$this->addSql('ALTER TABLE organisation_page_type ADD CONSTRAINT FK_EE569F2BB03A8386 FOREIGN KEY (created_by_id) REFERENCES users (id)');
$this->addSql('ALTER TABLE organisation_user ADD CONSTRAINT FK_CFD7D6519E6B1585 FOREIGN KEY (organisation_id) REFERENCES organisation (id)');
$this->addSql('ALTER TABLE organisation_user ADD CONSTRAINT FK_CFD7D651A76ED395 FOREIGN KEY (user_id) REFERENCES users (id)');
$this->addSql('ALTER TABLE user_password_recovery ADD CONSTRAINT FK_9BCBBA22A76ED395 FOREIGN KEY (user_id) REFERENCES users (id)');
$this->addSql('ALTER TABLE users ADD CONSTRAINT FK_1483A5E9B03A8386 FOREIGN KEY (created_by_id) REFERENCES users (id)');
$this->addSql('ALTER TABLE users ADD CONSTRAINT FK_1483A5E9896DBBDE FOREIGN KEY (updated_by_id) REFERENCES users (id)');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');
$this->addSql('ALTER TABLE news DROP FOREIGN KEY FK_1DD399503DA5256D');
$this->addSql('ALTER TABLE olympiad DROP FOREIGN KEY FK_77700B8EF98F144A');
$this->addSql('ALTER TABLE organisation DROP FOREIGN KEY FK_E6E132B4F98F144A');
$this->addSql('ALTER TABLE news DROP FOREIGN KEY FK_1DD39950C54C8C93');
$this->addSql('ALTER TABLE forum_thread DROP FOREIGN KEY FK_298F7F52BA0E79C3');
$this->addSql('ALTER TABLE forum_post DROP FOREIGN KEY FK_996BCC5AE2904019');
$this->addSql('ALTER TABLE olympiad_discipline DROP FOREIGN KEY FK_9DB4A07512469DE2');
$this->addSql('ALTER TABLE olympiad_discipline_relation DROP FOREIGN KEY FK_29F20D11A5522701');
$this->addSql('ALTER TABLE olympiad_grade_relation DROP FOREIGN KEY FK_F6E413DCFE19A1A8');
$this->addSql('ALTER TABLE olympiad DROP FOREIGN KEY FK_77700B8E5FB14BA7');
$this->addSql('ALTER TABLE olympiad_discipline_relation DROP FOREIGN KEY FK_29F20D113E1B5B3A');
$this->addSql('ALTER TABLE olympiad_grade_relation DROP FOREIGN KEY FK_F6E413DC3E1B5B3A');
$this->addSql('ALTER TABLE olympiad_stage DROP FOREIGN KEY FK_21AFE5053E1B5B3A');
$this->addSql('ALTER TABLE olympiad DROP FOREIGN KEY FK_77700B8E9E6B1585');
$this->addSql('ALTER TABLE organisation DROP FOREIGN KEY FK_E6E132B4727ACA70');
$this->addSql('ALTER TABLE organisation_page DROP FOREIGN KEY FK_564EB6389E6B1585');
$this->addSql('ALTER TABLE organisation_user DROP FOREIGN KEY FK_CFD7D6519E6B1585');
$this->addSql('ALTER TABLE organisation_page DROP FOREIGN KEY FK_564EB6383F2C6706');
$this->addSql('ALTER TABLE organisation DROP FOREIGN KEY FK_E6E132B4C54C8C93');
$this->addSql('ALTER TABLE organisation_page_type DROP FOREIGN KEY FK_EE569F2BC54C8C93');
$this->addSql('ALTER TABLE contacts DROP FOREIGN KEY FK_33401573B03A8386');
$this->addSql('ALTER TABLE contacts DROP FOREIGN KEY FK_33401573896DBBDE');
$this->addSql('ALTER TABLE files DROP FOREIGN KEY FK_6354059B03A8386');
$this->addSql('ALTER TABLE links DROP FOREIGN KEY FK_D182A118B03A8386');
$this->addSql('ALTER TABLE links DROP FOREIGN KEY FK_D182A118896DBBDE');
$this->addSql('ALTER TABLE reviews DROP FOREIGN KEY FK_6970EB0FA76ED395');
$this->addSql('ALTER TABLE news DROP FOREIGN KEY FK_1DD39950B03A8386');
$this->addSql('ALTER TABLE news DROP FOREIGN KEY FK_1DD39950896DBBDE');
$this->addSql('ALTER TABLE static_page DROP FOREIGN KEY FK_8FA4EF95B03A8386');
$this->addSql('ALTER TABLE static_page DROP FOREIGN KEY FK_8FA4EF95896DBBDE');
$this->addSql('ALTER TABLE forum_post DROP FOREIGN KEY FK_996BCC5AB03A8386');
$this->addSql('ALTER TABLE forum_post DROP FOREIGN KEY FK_996BCC5A896DBBDE');
$this->addSql('ALTER TABLE forum_thread DROP FOREIGN KEY FK_298F7F52B03A8386');
$this->addSql('ALTER TABLE forum_thread DROP FOREIGN KEY FK_298F7F52896DBBDE');
$this->addSql('ALTER TABLE olympiad_category DROP FOREIGN KEY FK_213E7678B03A8386');
$this->addSql('ALTER TABLE olympiad_discipline DROP FOREIGN KEY FK_9DB4A075B03A8386');
$this->addSql('ALTER TABLE olympiad_grade DROP FOREIGN KEY FK_BA89D858B03A8386');
$this->addSql('ALTER TABLE olympiad_grade DROP FOREIGN KEY FK_BA89D858896DBBDE');
$this->addSql('ALTER TABLE olympiad_level DROP FOREIGN KEY FK_7939BA7FB03A8386');
$this->addSql('ALTER TABLE olympiad DROP FOREIGN KEY FK_77700B8EB03A8386');
$this->addSql('ALTER TABLE olympiad DROP FOREIGN KEY FK_77700B8E896DBBDE');
$this->addSql('ALTER TABLE olympiad_stage DROP FOREIGN KEY FK_21AFE505B03A8386');
$this->addSql('ALTER TABLE olympiad_stage DROP FOREIGN KEY FK_21AFE505896DBBDE');
$this->addSql('ALTER TABLE organisation DROP FOREIGN KEY FK_E6E132B4B03A8386');
$this->addSql('ALTER TABLE organisation DROP FOREIGN KEY FK_E6E132B4896DBBDE');
$this->addSql('ALTER TABLE organisation_page DROP FOREIGN KEY FK_564EB638B03A8386');
$this->addSql('ALTER TABLE organisation_page DROP FOREIGN KEY FK_564EB638896DBBDE');
$this->addSql('ALTER TABLE organisation_page_type DROP FOREIGN KEY FK_EE569F2BB03A8386');
$this->addSql('ALTER TABLE organisation_user DROP FOREIGN KEY FK_CFD7D651A76ED395');
$this->addSql('ALTER TABLE user_password_recovery DROP FOREIGN KEY FK_9BCBBA22A76ED395');
$this->addSql('ALTER TABLE users DROP FOREIGN KEY FK_1483A5E9B03A8386');
$this->addSql('ALTER TABLE users DROP FOREIGN KEY FK_1483A5E9896DBBDE');
$this->addSql('DROP TABLE contacts');
$this->addSql('DROP TABLE files');
$this->addSql('DROP TABLE links');
$this->addSql('DROP TABLE reviews');
$this->addSql('DROP TABLE news');
$this->addSql('DROP TABLE news_type');
$this->addSql('DROP TABLE static_page');
$this->addSql('DROP TABLE forum_post');
$this->addSql('DROP TABLE forum_thread');
$this->addSql('DROP TABLE olympiad_category');
$this->addSql('DROP TABLE olympiad_discipline');
$this->addSql('DROP TABLE olympiad_grade');
$this->addSql('DROP TABLE olympiad_level');
$this->addSql('DROP TABLE olympiad');
$this->addSql('DROP TABLE olympiad_discipline_relation');
$this->addSql('DROP TABLE olympiad_grade_relation');
$this->addSql('DROP TABLE olympiad_stage');
$this->addSql('DROP TABLE organisation');
$this->addSql('DROP TABLE organisation_page');
$this->addSql('DROP TABLE organisation_page_type');
$this->addSql('DROP TABLE organisation_type');
$this->addSql('DROP TABLE organisation_user');
$this->addSql('DROP TABLE user_password_recovery');
$this->addSql('DROP TABLE phone_confirmation');
$this->addSql('DROP TABLE users');
}
}