migrations/Version20220411222817.php line 1

Open in your IDE?
  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 Version20220411222817 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 dark_owl (id INT AUTO_INCREMENT NOT NULL, domain_id INT NOT NULL, title VARCHAR(255) NOT NULL, body LONGTEXT NOT NULL, source VARCHAR(255) DEFAULT NULL, crawl_date DATETIME NOT NULL, hackishness DOUBLE PRECISION NOT NULL, url VARCHAR(255) NOT NULL, file_size DOUBLE PRECISION NOT NULL, document_id VARCHAR(255) NOT NULL, INDEX IDX_40D58D44115F0EE5 (domain_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  19.         $this->addSql('CREATE TABLE leak_actor (id INT AUTO_INCREMENT NOT NULL, leak_info_id INT NOT NULL, name VARCHAR(255) NOT NULL, INDEX IDX_D4DAEB9FDBFC5247 (leak_info_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  20.         $this->addSql('CREATE TABLE leak_association (id INT AUTO_INCREMENT NOT NULL, leak_info_id INT NOT NULL, name VARCHAR(255) NOT NULL, INDEX IDX_2364B08DDBFC5247 (leak_info_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  21.         $this->addSql('CREATE TABLE leak_email (id INT AUTO_INCREMENT NOT NULL, leak_info_id INT NOT NULL, email VARCHAR(255) NOT NULL, INDEX IDX_773DC112DBFC5247 (leak_info_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  22.         $this->addSql('CREATE TABLE leak_info (id INT AUTO_INCREMENT NOT NULL, name VARCHAR(255) NOT NULL, file_path VARCHAR(255) DEFAULT NULL, file_name VARCHAR(255) DEFAULT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  23.         $this->addSql('ALTER TABLE dark_owl ADD CONSTRAINT FK_40D58D44115F0EE5 FOREIGN KEY (domain_id) REFERENCES domain (id)');
  24.         $this->addSql('ALTER TABLE leak_actor ADD CONSTRAINT FK_D4DAEB9FDBFC5247 FOREIGN KEY (leak_info_id) REFERENCES leak_info (id)');
  25.         $this->addSql('ALTER TABLE leak_association ADD CONSTRAINT FK_2364B08DDBFC5247 FOREIGN KEY (leak_info_id) REFERENCES leak_info (id)');
  26.         $this->addSql('ALTER TABLE leak_email ADD CONSTRAINT FK_773DC112DBFC5247 FOREIGN KEY (leak_info_id) REFERENCES leak_info (id)');
  27.     }
  28.     public function down(Schema $schema): void
  29.     {
  30.         // this down() migration is auto-generated, please modify it to your needs
  31.         $this->addSql('ALTER TABLE leak_actor DROP FOREIGN KEY FK_D4DAEB9FDBFC5247');
  32.         $this->addSql('ALTER TABLE leak_association DROP FOREIGN KEY FK_2364B08DDBFC5247');
  33.         $this->addSql('ALTER TABLE leak_email DROP FOREIGN KEY FK_773DC112DBFC5247');
  34.         $this->addSql('DROP TABLE dark_owl');
  35.         $this->addSql('DROP TABLE leak_actor');
  36.         $this->addSql('DROP TABLE leak_association');
  37.         $this->addSql('DROP TABLE leak_email');
  38.         $this->addSql('DROP TABLE leak_info');
  39.     }
  40. }