rm unnecessary additional method

This commit is contained in:
MaxBUhe 2023-04-03 11:57:56 +02:00
parent 85b0adfcbf
commit d0d90c4250

View File

@ -9,7 +9,6 @@ use Doctrine\Migrations\AbstractMigration;
use Doctrine\DBAL\Schema\Schema; use Doctrine\DBAL\Schema\Schema;
use Doctrine\DBAL\Schema\SchemaException; use Doctrine\DBAL\Schema\SchemaException;
use Doctrine\DBAL\Types\TextType; use Doctrine\DBAL\Types\TextType;
use OxidEsales\Eshop\Core\DatabaseProvider;
use OxidEsales\Eshop\Core\Exception\DatabaseConnectionException; use OxidEsales\Eshop\Core\Exception\DatabaseConnectionException;
use OxidEsales\Eshop\Core\Exception\DatabaseErrorException; use OxidEsales\Eshop\Core\Exception\DatabaseErrorException;
@ -26,8 +25,6 @@ final class Version20230403083243 extends AbstractMigration
/** /**
* @throws SchemaException * @throws SchemaException
* @throws DBALException * @throws DBALException
* @throws DatabaseErrorException
* @throws DatabaseConnectionException
*/ */
public function up(Schema $schema) : void public function up(Schema $schema) : void
{ {
@ -35,9 +32,10 @@ final class Version20230403083243 extends AbstractMigration
$table = $schema->getTable('oxcategories'); $table = $schema->getTable('oxcategories');
$table->hasColumn('D3LONGDESC2') ?: if (!$table->hasColumn('D3LONGDESC2')){
$table->addColumn('D3LONGDESC2', (new TextType())->getName()) $table->addColumn('D3LONGDESC2', (new TextType())->getName())
->setNotnull(true); ->setNotnull(true);
}
$table->hasColumn('D3LONGDESC2_1') ?: $table->hasColumn('D3LONGDESC2_1') ?:
$table->addColumn('D3LONGDESC2_1', (new TextType())->getName()) $table->addColumn('D3LONGDESC2_1', (new TextType())->getName())
@ -50,31 +48,6 @@ final class Version20230403083243 extends AbstractMigration
$table->hasColumn('D3LONGDESC2_3') ?: $table->hasColumn('D3LONGDESC2_3') ?:
$table->addColumn('D3LONGDESC2_3', (new TextType())->getName()) $table->addColumn('D3LONGDESC2_3', (new TextType())->getName())
->setNotnull(true); ->setNotnull(true);
$this->postProcesses();
}
/**
* @throws DatabaseErrorException
* @throws DatabaseConnectionException
*/
public function postProcesses(){
$sAltering = 'ALTER TABLE oxcategories MODIFY
? text
CHARACTER SET latin1
COLLATE latin1_swedish_ci;';
$aAlterColumns = [
'D3LONGDESC2',
'D3LONGDESC2_1',
'D3LONGDESC2_2',
'D3LONGDESC2_3'
];
foreach ($aAlterColumns as $column){
DatabaseProvider::getDb()->execute($sAltering, $column);
}
} }
public function down(Schema $schema) : void public function down(Schema $schema) : void