manufacturer-information/migration/data/Version20241023154223.php

65 lines
1.8 KiB
PHP
Raw Permalink Normal View History

2024-10-23 20:19:34 +02:00
<?php
2024-11-20 18:50:18 +01:00
/**
* Copyright (c) D3 Data Development (Inh. Thomas Dartsch)
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*
* https://www.d3data.de
*
* @copyright (C) D3 Data Development (Inh. Thomas Dartsch)
* @author D3 Data Development - Max Buhe, Daniel Seifert <info@shopmodule.com>
* @link https://www.oxidmodule.com
*/
2024-10-23 20:19:34 +02:00
declare(strict_types=1);
namespace D3\ManufacturerInformation\Migrations;
use Doctrine\DBAL\Schema\Schema;
2025-01-03 15:11:14 +01:00
use Doctrine\DBAL\Schema\SchemaException;
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
{
2024-11-20 18:50:18 +01:00
public function getDescription(): string
2024-10-23 20:19:34 +02:00
{
return 'Adds the D3 manufacturer longdesc column';
}
2024-11-20 18:50:18 +01:00
public function up(Schema $schema): void
{
$this->connection->getDatabasePlatform()->registerDoctrineTypeMapping('enum', 'string');
$this->d3AddLongdescColumnToOxmanufacturers($schema);
}
public function down(Schema $schema): void
{
}
/**
* @param Schema $schema
* @return void
2025-01-03 15:11:14 +01:00
* @throws SchemaException
2024-11-20 18:50:18 +01:00
*/
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
}