src/Migrations/Version20201119140511.php line 1

  1. <?php
  2. declare(strict_types=1);
  3. namespace DoctrineMigrations;
  4. use Doctrine\DBAL\Schema\Schema;
  5. use Doctrine\Migrations\AbstractMigration;
  6. /**
  7.  * Auto-generated Migration: Please modify to your needs!
  8.  */
  9. final class Version20201119140511 extends AbstractMigration
  10. {
  11.     public function getDescription(): string
  12.     {
  13.         return '';
  14.     }
  15.     public function up(Schema $schema): void
  16.     {
  17.         // this up() migration is auto-generated, please modify it to your needs
  18.         $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');
  19.         $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');
  20.         $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');
  21.         $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');
  22.         $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');
  23.         $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');
  24.         $this->addSql('ALTER TABLE organisation_success_history ADD CONSTRAINT FK_7D3B61C97E9E4C8C FOREIGN KEY (photo_id) REFERENCES files (id)');
  25.         $this->addSql('ALTER TABLE organisation_success_history ADD CONSTRAINT FK_7D3B61C99E6B1585 FOREIGN KEY (organisation_id) REFERENCES organisation (id)');
  26.         $this->addSql('ALTER TABLE organisation_success_history ADD CONSTRAINT FK_7D3B61C9B03A8386 FOREIGN KEY (created_by_id) REFERENCES users (id)');
  27.         $this->addSql('ALTER TABLE organisation_success_history ADD CONSTRAINT FK_7D3B61C9896DBBDE FOREIGN KEY (updated_by_id) REFERENCES users (id)');
  28.         $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');
  29.         $this->addSql('ALTER TABLE organisation_success_history_olympiad_relation ADD CONSTRAINT FK_C0694AAF3E1B5B3A FOREIGN KEY (olympiad_id) REFERENCES olympiad (id) ON DELETE CASCADE');
  30.         $this->addSql('ALTER TABLE scholar_olympiad_relation ADD CONSTRAINT FK_6A81409FCCFA12B8 FOREIGN KEY (profile_id) REFERENCES scholar_profile (id) ON DELETE CASCADE');
  31.         $this->addSql('ALTER TABLE scholar_olympiad_relation ADD CONSTRAINT FK_6A81409F3E1B5B3A FOREIGN KEY (olympiad_id) REFERENCES olympiad (id) ON DELETE CASCADE');
  32.         $this->addSql('ALTER TABLE scholar_discipline_relation ADD CONSTRAINT FK_A132238ECCFA12B8 FOREIGN KEY (profile_id) REFERENCES scholar_profile (id) ON DELETE CASCADE');
  33.         $this->addSql('ALTER TABLE scholar_discipline_relation ADD CONSTRAINT FK_A132238EA5522701 FOREIGN KEY (discipline_id) REFERENCES olympiad_discipline (id) ON DELETE CASCADE');
  34.         $this->addSql('ALTER TABLE subscribe_subscriber ADD CONSTRAINT FK_1B81DB06A76ED395 FOREIGN KEY (user_id) REFERENCES users (id)');
  35.         $this->addSql('ALTER TABLE subscribe_subscriber ADD CONSTRAINT FK_1B81DB069A1887DC FOREIGN KEY (subscription_id) REFERENCES subscribe_subscription (id)');
  36.         $this->addSql('ALTER TABLE subscribe_subscription ADD CONSTRAINT FK_AC1B261AB03A8386 FOREIGN KEY (created_by_id) REFERENCES users (id)');
  37.         $this->addSql('ALTER TABLE subscribe_subscription ADD CONSTRAINT FK_AC1B261A896DBBDE FOREIGN KEY (updated_by_id) REFERENCES users (id)');
  38.         $this->addSql('ALTER TABLE scholar_profile ADD about LONGTEXT DEFAULT NULL');
  39.     }
  40.     public function down(Schema $schema): void
  41.     {
  42.         // this down() migration is auto-generated, please modify it to your needs
  43.         $this->addSql('ALTER TABLE organisation_success_history_olympiad_relation DROP FOREIGN KEY FK_C0694AAFDD78D5BB');
  44.         $this->addSql('ALTER TABLE subscribe_subscriber DROP FOREIGN KEY FK_1B81DB069A1887DC');
  45.         $this->addSql('DROP TABLE organisation_success_history');
  46.         $this->addSql('DROP TABLE organisation_success_history_olympiad_relation');
  47.         $this->addSql('DROP TABLE scholar_olympiad_relation');
  48.         $this->addSql('DROP TABLE scholar_discipline_relation');
  49.         $this->addSql('DROP TABLE subscribe_subscriber');
  50.         $this->addSql('DROP TABLE subscribe_subscription');
  51.         $this->addSql('ALTER TABLE scholar_profile DROP about');
  52.     }
  53. }