<?php

namespace Neos\Flow\Persistence\Doctrine\Migrations;

use Doctrine\Migrations\AbstractMigration;
use Doctrine\DBAL\Schema\Schema;

class Version20250930145832 extends AbstractMigration
{
    /**
     * @param Schema $schema
     * @return void
     */
    public function up(Schema $schema)
    {
        // this up() migration is autogenerated, 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 newland_toubiz_sync_neos_domain_model_event ADD mainmedium CHAR(36) DEFAULT NULL COMMENT \'(DC2Type:guid)\'');
        $this->addSql('ALTER TABLE newland_toubiz_sync_neos_domain_model_event ADD CONSTRAINT FK_4DAD30E6EF171A6D FOREIGN KEY (mainmedium) REFERENCES newland_toubiz_sync_neos_domain_model_medium (persistence_object_identifier)');
        $this->addSql('CREATE INDEX IDX_4DAD30E6EF171A6D ON newland_toubiz_sync_neos_domain_model_event (mainmedium)');
    }

    /**
     * @param Schema $schema
     * @return void
     */
    public function down(Schema $schema)
    {
        // this down() migration is autogenerated, 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 newland_toubiz_sync_neos_domain_model_event DROP FOREIGN KEY FK_4DAD30E6EF171A6D');
        $this->addSql('DROP INDEX IDX_4DAD30E6EF171A6D ON newland_toubiz_sync_neos_domain_model_event');
        $this->addSql('ALTER TABLE newland_toubiz_sync_neos_domain_model_event DROP mainmedium');
    }
}
