2024-10-23 20:19:34 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
|
|
namespace D3\ManufacturerInformation\Migrations;
|
|
|
|
|
|
|
|
use Doctrine\DBAL\Schema\Schema;
|
2024-11-13 16:34:45 +01:00
|
|
|
use Doctrine\DBAL\Types\TextType;
|
2024-10-23 20:19:34 +02:00
|
|
|
use Doctrine\Migrations\AbstractMigration;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Auto-generated Migration: Please modify to your needs!
|
|
|
|
*/
|
|
|
|
final class Version20241023154223 extends AbstractMigration
|
|
|
|
{
|
|
|
|
public function getDescription() : string
|
|
|
|
{
|
|
|
|
return 'Adds the D3 manufacturer longdesc column';
|
|
|
|
}
|
2024-11-19 09:54:00 +01:00
|
|
|
|
|
|
|
public function up(Schema $schema) : void
|
|
|
|
{
|
|
|
|
$this->connection->getDatabasePlatform()->registerDoctrineTypeMapping('enum', 'string');
|
|
|
|
|
|
|
|
$this->d3AddLongdescColumnToOxmanufacturers($schema);
|
|
|
|
}
|
2024-10-23 20:19:34 +02:00
|
|
|
|
|
|
|
public function down(Schema $schema) : void
|
2024-11-13 22:33:11 +01:00
|
|
|
{}
|
2024-11-19 09:54:00 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @param Schema $schema
|
|
|
|
* @return void
|
|
|
|
* @throws \Doctrine\DBAL\Schema\SchemaException
|
|
|
|
*/
|
|
|
|
public function d3AddLongdescColumnToOxmanufacturers(Schema $schema){
|
|
|
|
$table = !$schema->hasTable('oxmanufacturers') ?
|
|
|
|
$schema->createTable('oxmanufacturers') :
|
|
|
|
$schema->getTable('oxmanufacturers');
|
|
|
|
|
|
|
|
// Beschreibung
|
|
|
|
if (!$table->hasColumn('D3DESCRIPTION')) {
|
|
|
|
$table->addColumn('D3DESCRIPTION', (new TextType())->getName())
|
|
|
|
->setLength($this->connection->getDatabasePlatform()::LENGTH_LIMIT_TEXT)
|
|
|
|
->setNotnull(true);
|
|
|
|
}
|
|
|
|
}
|
2024-10-23 20:19:34 +02:00
|
|
|
}
|