<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\DBAL\Types\Types;
use Doctrine\Migrations\AbstractMigration;
final class Version20230329122000 extends AbstractMigration
{
public function getDescription(): string
{
return 'Add vendor_document_model_name field to the predefined_template table';
}
public function up(Schema $schema): void
{
$this->skipIf(
true === $schema->getTable('predefined_template')->hasColumn('vendor_document_model_name'),
'The vendor_document_model_name field already exists in the predefined_template table!'
);
$schema->getTable('predefined_template')
->addColumn('vendor_document_model_name', Types::STRING, [
'length' => 255,
])
->setNotnull(false);
}
public function down(Schema $schema): void
{
$this->skipIf(
false === $schema->getTable('predefined_template')->hasColumn('vendor_document_model_name'),
'The vendor_document_model_name is already removed from the predefined_template table!'
);
$schema->getTable('predefined_template')
->dropColumn('vendor_document_model_name');
}
}