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

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

class Version20221129171930 extends AbstractMigration
{
    public function getDescription(): string
    {
        return 'Add field "sourceapiversion" to articles.';
    }

    public function up(Schema $schema): void
    {
        // 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_article ADD sourceapiversion VARCHAR(15) DEFAULT NULL AFTER sourcesystem'
        );
    }

    public function down(Schema $schema): void
    {
        // 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 DROP sourceapiversion');
    }
}
