<?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 Version20251124100134 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 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');
$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');
$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');
$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');
$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');
$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');
$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');
$this->addSql('ALTER TABLE channel_google_drive_folder ADD CONSTRAINT FK_F0861E0372F5A1AA FOREIGN KEY (channel_id) REFERENCES channel_channels (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE google_drive_file ADD CONSTRAINT FK_148FFCAA727ACA70 FOREIGN KEY (parent_id) REFERENCES google_drive_folder (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE google_drive_folder ADD CONSTRAINT FK_8939FC41727ACA70 FOREIGN KEY (parent_id) REFERENCES google_drive_folder (id) ON DELETE CASCADE');
$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');
$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');
$this->addSql('ALTER TABLE channel_channels ADD channel_google_drive_folder_id INT DEFAULT NULL');
$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');
$this->addSql('CREATE UNIQUE INDEX UNIQ_84A4911FB49D6253 ON channel_channels (channel_google_drive_folder_id)');
$this->addSql('ALTER TABLE channel_positioning_test_attempts ADD google_exported_data_id INT DEFAULT NULL');
$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');
$this->addSql('CREATE UNIQUE INDEX UNIQ_AEEA1A75A7951905 ON channel_positioning_test_attempts (google_exported_data_id)');
$this->addSql('ALTER TABLE channel_positioning_tests ADD google_drive_file_id INT DEFAULT NULL');
$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');
$this->addSql('CREATE UNIQUE INDEX UNIQ_E24E951877A02D92 ON channel_positioning_tests (google_drive_file_id)');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE channel_channels DROP FOREIGN KEY FK_84A4911FB49D6253');
$this->addSql('ALTER TABLE channel_positioning_tests DROP FOREIGN KEY FK_E24E951877A02D92');
$this->addSql('ALTER TABLE channel_positioning_test_attempts DROP FOREIGN KEY FK_AEEA1A75A7951905');
$this->addSql('ALTER TABLE channel_google_drive_folder DROP FOREIGN KEY FK_F0861E0393934913');
$this->addSql('ALTER TABLE channel_google_drive_folder DROP FOREIGN KEY FK_F0861E0370351A47');
$this->addSql('ALTER TABLE channel_google_drive_folder DROP FOREIGN KEY FK_F0861E0372F5A1AA');
$this->addSql('ALTER TABLE google_drive_file DROP FOREIGN KEY FK_148FFCAA727ACA70');
$this->addSql('ALTER TABLE google_drive_folder DROP FOREIGN KEY FK_8939FC41727ACA70');
$this->addSql('ALTER TABLE google_drive_permission DROP FOREIGN KEY FK_5BA4EC14F01504F7');
$this->addSql('ALTER TABLE google_exported_data DROP FOREIGN KEY FK_5004E1DB77A02D92');
$this->addSql('DROP TABLE channel_google_drive_folder');
$this->addSql('DROP TABLE google_drive_file');
$this->addSql('DROP TABLE google_drive_folder');
$this->addSql('DROP TABLE google_drive_permission');
$this->addSql('DROP TABLE google_exported_data');
$this->addSql('DROP INDEX UNIQ_E24E951877A02D92 ON channel_positioning_tests');
$this->addSql('ALTER TABLE channel_positioning_tests DROP google_drive_file_id');
$this->addSql('DROP INDEX UNIQ_84A4911FB49D6253 ON channel_channels');
$this->addSql('ALTER TABLE channel_channels DROP channel_google_drive_folder_id');
$this->addSql('DROP INDEX UNIQ_AEEA1A75A7951905 ON channel_positioning_test_attempts');
$this->addSql('ALTER TABLE channel_positioning_test_attempts DROP google_exported_data_id');
}
}