<?php
namespace Neos\Flow\Persistence\Doctrine\Migrations;

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

/**
 * Auto-generated Migration: Please modify to your needs! This block will be used as the migration description if getDescription() is not used.
 */
class Version20200818150626 extends AbstractMigration
{

    /**
     * @return string
     */
    public function getDescription()
    {
        return '';
    }

    /**
     * @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('DROP TABLE newland_toubiz_sync_neos_domain_model_article_awards_join');
        $this->addSql('ALTER TABLE newland_toubiz_sync_neos_domain_model_award ADD article CHAR(36) DEFAULT NULL COMMENT \'(DC2Type:guid)\'');
        $this->addSql('ALTER TABLE newland_toubiz_sync_neos_domain_model_award ADD CONSTRAINT FK_FC5814A623A0E66 FOREIGN KEY (article) REFERENCES newland_toubiz_sync_neos_domain_model_article (persistence_object_identifier)');
        $this->addSql('CREATE INDEX IDX_FC5814A623A0E66 ON newland_toubiz_sync_neos_domain_model_award (article)');
    }

    /**
     * @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('CREATE TABLE newland_toubiz_sync_neos_domain_model_article_awards_join (neos_article CHAR(36) CHARACTER SET utf8mb4 NOT NULL COLLATE `utf8mb4_unicode_ci` COMMENT \'(DC2Type:guid)\', neos_award CHAR(36) CHARACTER SET utf8mb4 NOT NULL COLLATE `utf8mb4_unicode_ci` COMMENT \'(DC2Type:guid)\', INDEX IDX_1016901E61A7D39C (neos_article), INDEX IDX_1016901E5FBA8327 (neos_award), PRIMARY KEY(neos_article, neos_award)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_unicode_ci` ENGINE = InnoDB COMMENT = \'\' ');
        $this->addSql('ALTER TABLE newland_toubiz_sync_neos_domain_model_article_awards_join ADD CONSTRAINT FK_1016901E5FBA8327 FOREIGN KEY (neos_award) REFERENCES newland_toubiz_sync_neos_domain_model_award (persistence_object_identifier)');
        $this->addSql('ALTER TABLE newland_toubiz_sync_neos_domain_model_article_awards_join ADD CONSTRAINT FK_1016901E61A7D39C FOREIGN KEY (neos_article) REFERENCES newland_toubiz_sync_neos_domain_model_article (persistence_object_identifier)');
        $this->addSql('ALTER TABLE newland_toubiz_sync_neos_domain_model_award DROP FOREIGN KEY FK_FC5814A623A0E66');
        $this->addSql('DROP INDEX IDX_FC5814A623A0E66 ON newland_toubiz_sync_neos_domain_model_award');
        $this->addSql('ALTER TABLE newland_toubiz_sync_neos_domain_model_award DROP article');
    }
}
