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

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

/**
 * Spreadsheet import domain
 */
class Version20161003124329 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 we_spreadsheetimport_domain_model_spreadsheetimport (persistence_object_identifier VARCHAR(40) NOT NULL, file VARCHAR(40) DEFAULT NULL, context VARCHAR(255) NOT NULL, scheduledate DATETIME NOT NULL, mapping LONGTEXT NOT NULL, `inserting` TINYINT(1) NOT NULL, `updating` TINYINT(1) NOT NULL, `deleting` TINYINT(1) NOT NULL, totalinserted INT NOT NULL, totalupdated INT NOT NULL, totaldeleted INT NOT NULL, totalskipped INT NOT NULL, UNIQUE INDEX UNIQ_19518FA38C9F3610 (file), PRIMARY KEY(persistence_object_identifier)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB');
        $this->addSql('ALTER TABLE we_spreadsheetimport_domain_model_spreadsheetimport ADD CONSTRAINT FK_19518FA38C9F3610 FOREIGN KEY (file) REFERENCES typo3_flow_resource_resource (persistence_object_identifier)');
    }

    /**
     * @param Schema $schema
     * @return void
     */
    public function down(Schema $schema)
    {
        $this->abortIf($this->connection->getDatabasePlatform()->getName() != 'mysql', 'Migration can only be executed safely on "mysql".');

        $this->addSql('DROP TABLE we_spreadsheetimport_domain_model_spreadsheetimport');
    }
}