2023-04-03 11:05:04 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
|
|
namespace D3\CategoryLongtext\Migrations;
|
|
|
|
|
|
|
|
use Doctrine\DBAL\DBALException;
|
2023-04-03 11:36:44 +02:00
|
|
|
use Doctrine\Migrations\AbstractMigration;
|
2023-04-03 11:05:04 +02:00
|
|
|
use Doctrine\DBAL\Schema\Schema;
|
|
|
|
use Doctrine\DBAL\Schema\SchemaException;
|
|
|
|
use Doctrine\DBAL\Types\TextType;
|
|
|
|
use OxidEsales\Eshop\Core\Exception\DatabaseConnectionException;
|
|
|
|
use OxidEsales\Eshop\Core\Exception\DatabaseErrorException;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Auto-generated Migration: Please modify to your needs!
|
|
|
|
*/
|
|
|
|
final class Version20230403083243 extends AbstractMigration
|
|
|
|
{
|
|
|
|
public function getDescription() : string
|
|
|
|
{
|
|
|
|
return 'Check and set of potential missing columns';
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @throws SchemaException
|
|
|
|
* @throws DBALException
|
|
|
|
*/
|
|
|
|
public function up(Schema $schema) : void
|
|
|
|
{
|
|
|
|
$this->connection->getDatabasePlatform()->registerDoctrineTypeMapping('enum', 'string');
|
|
|
|
|
|
|
|
$table = $schema->getTable('oxcategories');
|
|
|
|
|
2023-04-03 11:57:56 +02:00
|
|
|
if (!$table->hasColumn('D3LONGDESC2')){
|
2023-04-03 11:36:44 +02:00
|
|
|
$table->addColumn('D3LONGDESC2', (new TextType())->getName())
|
2023-04-03 11:05:04 +02:00
|
|
|
->setNotnull(true);
|
2023-04-03 11:57:56 +02:00
|
|
|
}
|
2023-04-03 11:05:04 +02:00
|
|
|
|
|
|
|
$table->hasColumn('D3LONGDESC2_1') ?:
|
2023-04-03 11:36:44 +02:00
|
|
|
$table->addColumn('D3LONGDESC2_1', (new TextType())->getName())
|
2023-04-03 11:05:04 +02:00
|
|
|
->setNotnull(true);
|
|
|
|
|
|
|
|
$table->hasColumn('D3LONGDESC2_2') ?:
|
2023-04-03 11:36:44 +02:00
|
|
|
$table->addColumn('D3LONGDESC2_2', (new TextType())->getName())
|
2023-04-03 11:05:04 +02:00
|
|
|
->setNotnull(true);
|
|
|
|
|
|
|
|
$table->hasColumn('D3LONGDESC2_3') ?:
|
2023-04-03 11:36:44 +02:00
|
|
|
$table->addColumn('D3LONGDESC2_3', (new TextType())->getName())
|
2023-04-03 11:05:04 +02:00
|
|
|
->setNotnull(true);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function down(Schema $schema) : void
|
|
|
|
{
|
|
|
|
// this down() migration is auto-generated, please modify it to your needs
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|