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

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

/**
 * Auto-generated Migration: Please modify to your needs! This block will be used as the migration description if
 * getDescription() is not used.
 */
class Version20200723104656 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_award (persistence_object_identifier CHAR(36) NOT NULL COMMENT \'(DC2Type:guid)\', article CHAR(36) DEFAULT NULL COMMENT \'(DC2Type:guid)\', name VARCHAR(255) NOT NULL, description LONGTEXT DEFAULT NULL, iconname VARCHAR(50) NOT NULL, image VARCHAR(255) DEFAULT NULL, value DOUBLE PRECISION DEFAULT NULL, showinlist TINYINT(1) NOT NULL, originalid VARCHAR(50) NOT NULL, language CHAR(2) DEFAULT NULL, languagegrouping VARCHAR(255) DEFAULT NULL, INDEX IDX_FC5814A623A0E66 (article), 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_award ADD CONSTRAINT FK_FC5814A623A0E66 FOREIGN KEY (article) REFERENCES newland_toubiz_sync_neos_domain_model_article (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('DROP TABLE newland_toubiz_sync_neos_domain_model_award');
    }
}
