migrations/Version20251124100134.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 Version20251124100134 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 channel_google_drive_folder (id INT AUTO_INCREMENT NOT NULL, channel_root_folder_id INT DEFAULT NULL, positioning_test_folder_id INT DEFAULT NULL, channel_id VARCHAR(36) NOT NULL, UNIQUE INDEX UNIQ_F0861E0393934913 (channel_root_folder_id), UNIQUE INDEX UNIQ_F0861E0370351A47 (positioning_test_folder_id), UNIQUE INDEX UNIQ_F0861E0372F5A1AA (channel_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  19.         $this->addSql('CREATE TABLE google_drive_file (id INT AUTO_INCREMENT NOT NULL, parent_id INT DEFAULT NULL, name VARCHAR(255) NOT NULL, google_id VARCHAR(255) NOT NULL, created_at DATETIME NOT NULL, updated_at DATETIME DEFAULT NULL, google_type VARCHAR(255) NOT NULL, inner_type VARCHAR(255) DEFAULT NULL, INDEX IDX_148FFCAA727ACA70 (parent_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  20.         $this->addSql('CREATE TABLE google_drive_folder (id INT AUTO_INCREMENT NOT NULL, parent_id INT DEFAULT NULL, name VARCHAR(255) NOT NULL, google_id VARCHAR(255) NOT NULL, created_at DATETIME NOT NULL, updated_at DATETIME DEFAULT NULL, type VARCHAR(255) DEFAULT NULL, INDEX IDX_8939FC41727ACA70 (parent_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  21.         $this->addSql('CREATE TABLE google_drive_permission (id INT AUTO_INCREMENT NOT NULL, google_drive_folder_id INT NOT NULL, email VARCHAR(255) NOT NULL, role VARCHAR(255) NOT NULL, created_at DATETIME NOT NULL, updated_at DATETIME DEFAULT NULL, INDEX IDX_5BA4EC14F01504F7 (google_drive_folder_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  22.         $this->addSql('CREATE TABLE google_exported_data (id INT AUTO_INCREMENT NOT NULL, google_drive_file_id INT NOT NULL, row_number INT NOT NULL, INDEX IDX_5004E1DB77A02D92 (google_drive_file_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  23.         $this->addSql('ALTER TABLE channel_google_drive_folder ADD CONSTRAINT FK_F0861E0393934913 FOREIGN KEY (channel_root_folder_id) REFERENCES google_drive_folder (id) ON DELETE SET NULL');
  24.         $this->addSql('ALTER TABLE channel_google_drive_folder ADD CONSTRAINT FK_F0861E0370351A47 FOREIGN KEY (positioning_test_folder_id) REFERENCES google_drive_folder (id) ON DELETE SET NULL');
  25.         $this->addSql('ALTER TABLE channel_google_drive_folder ADD CONSTRAINT FK_F0861E0372F5A1AA FOREIGN KEY (channel_id) REFERENCES channel_channels (id) ON DELETE CASCADE');
  26.         $this->addSql('ALTER TABLE google_drive_file ADD CONSTRAINT FK_148FFCAA727ACA70 FOREIGN KEY (parent_id) REFERENCES google_drive_folder (id) ON DELETE CASCADE');
  27.         $this->addSql('ALTER TABLE google_drive_folder ADD CONSTRAINT FK_8939FC41727ACA70 FOREIGN KEY (parent_id) REFERENCES google_drive_folder (id) ON DELETE CASCADE');
  28.         $this->addSql('ALTER TABLE google_drive_permission ADD CONSTRAINT FK_5BA4EC14F01504F7 FOREIGN KEY (google_drive_folder_id) REFERENCES google_drive_folder (id) ON DELETE CASCADE');
  29.         $this->addSql('ALTER TABLE google_exported_data ADD CONSTRAINT FK_5004E1DB77A02D92 FOREIGN KEY (google_drive_file_id) REFERENCES google_drive_file (id) ON DELETE CASCADE');
  30.         $this->addSql('ALTER TABLE channel_channels ADD channel_google_drive_folder_id INT DEFAULT NULL');
  31.         $this->addSql('ALTER TABLE channel_channels ADD CONSTRAINT FK_84A4911FB49D6253 FOREIGN KEY (channel_google_drive_folder_id) REFERENCES channel_google_drive_folder (id) ON DELETE SET NULL');
  32.         $this->addSql('CREATE UNIQUE INDEX UNIQ_84A4911FB49D6253 ON channel_channels (channel_google_drive_folder_id)');
  33.         $this->addSql('ALTER TABLE channel_positioning_test_attempts ADD google_exported_data_id INT DEFAULT NULL');
  34.         $this->addSql('ALTER TABLE channel_positioning_test_attempts ADD CONSTRAINT FK_AEEA1A75A7951905 FOREIGN KEY (google_exported_data_id) REFERENCES google_exported_data (id) ON DELETE SET NULL');
  35.         $this->addSql('CREATE UNIQUE INDEX UNIQ_AEEA1A75A7951905 ON channel_positioning_test_attempts (google_exported_data_id)');
  36.         $this->addSql('ALTER TABLE channel_positioning_tests ADD google_drive_file_id INT DEFAULT NULL');
  37.         $this->addSql('ALTER TABLE channel_positioning_tests ADD CONSTRAINT FK_E24E951877A02D92 FOREIGN KEY (google_drive_file_id) REFERENCES google_drive_file (id) ON DELETE SET NULL');
  38.         $this->addSql('CREATE UNIQUE INDEX UNIQ_E24E951877A02D92 ON channel_positioning_tests (google_drive_file_id)');
  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 channel_channels DROP FOREIGN KEY FK_84A4911FB49D6253');
  44.         $this->addSql('ALTER TABLE channel_positioning_tests DROP FOREIGN KEY FK_E24E951877A02D92');
  45.         $this->addSql('ALTER TABLE channel_positioning_test_attempts DROP FOREIGN KEY FK_AEEA1A75A7951905');
  46.         $this->addSql('ALTER TABLE channel_google_drive_folder DROP FOREIGN KEY FK_F0861E0393934913');
  47.         $this->addSql('ALTER TABLE channel_google_drive_folder DROP FOREIGN KEY FK_F0861E0370351A47');
  48.         $this->addSql('ALTER TABLE channel_google_drive_folder DROP FOREIGN KEY FK_F0861E0372F5A1AA');
  49.         $this->addSql('ALTER TABLE google_drive_file DROP FOREIGN KEY FK_148FFCAA727ACA70');
  50.         $this->addSql('ALTER TABLE google_drive_folder DROP FOREIGN KEY FK_8939FC41727ACA70');
  51.         $this->addSql('ALTER TABLE google_drive_permission DROP FOREIGN KEY FK_5BA4EC14F01504F7');
  52.         $this->addSql('ALTER TABLE google_exported_data DROP FOREIGN KEY FK_5004E1DB77A02D92');
  53.         $this->addSql('DROP TABLE channel_google_drive_folder');
  54.         $this->addSql('DROP TABLE google_drive_file');
  55.         $this->addSql('DROP TABLE google_drive_folder');
  56.         $this->addSql('DROP TABLE google_drive_permission');
  57.         $this->addSql('DROP TABLE google_exported_data');
  58.         $this->addSql('DROP INDEX UNIQ_E24E951877A02D92 ON channel_positioning_tests');
  59.         $this->addSql('ALTER TABLE channel_positioning_tests DROP google_drive_file_id');
  60.         $this->addSql('DROP INDEX UNIQ_84A4911FB49D6253 ON channel_channels');
  61.         $this->addSql('ALTER TABLE channel_channels DROP channel_google_drive_folder_id');
  62.         $this->addSql('DROP INDEX UNIQ_AEEA1A75A7951905 ON channel_positioning_test_attempts');
  63.         $this->addSql('ALTER TABLE channel_positioning_test_attempts DROP google_exported_data_id');
  64.     }
  65. }