<?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 Version20191220143246 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('CREATE TABLE newland_toubiz_sync_neos_domain_model_article_externalids_join (neos_article CHAR(36) NOT NULL COMMENT \'(DC2Type:guid)\', newland_model_externalid CHAR(36) NOT NULL COMMENT \'(DC2Type:guid)\', INDEX IDX_75F6A35261A7D39C (neos_article), INDEX IDX_75F6A3523D3201FA (newland_model_externalid), PRIMARY KEY(neos_article, newland_model_externalid)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
        $this->addSql('CREATE TABLE newland_toubiz_sync_neos_domain_model_externalid (persistence_object_identifier CHAR(36) NOT NULL COMMENT \'(DC2Type:guid)\', type VARCHAR(255) NOT NULL, id VARCHAR(255) NOT NULL, UNIQUE INDEX UNIQ_B3D281D98CDE5729BF396750 (type, id), PRIMARY KEY(persistence_object_identifier)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
        $this->addSql('ALTER TABLE newland_toubiz_sync_neos_domain_model_article_externalids_join ADD CONSTRAINT FK_75F6A35261A7D39C 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_article_externalids_join ADD CONSTRAINT FK_75F6A3523D3201FA FOREIGN KEY (newland_model_externalid) REFERENCES newland_toubiz_sync_neos_domain_model_externalid (persistence_object_identifier)');
    }

    /**
     * @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_article_externalids_join DROP FOREIGN KEY FK_75F6A3523D3201FA');
        $this->addSql('DROP TABLE newland_toubiz_sync_neos_domain_model_article_externalids_join');
        $this->addSql('DROP TABLE newland_toubiz_sync_neos_domain_model_externalid');
    }
}