<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Thêm field email05 vào bảng dtb_base_info
*/
final class Version20251216160000 extends AbstractMigration
{
public function getDescription(): string
{
return 'Add email05 column to dtb_base_info table';
}
public function up(Schema $schema): void
{
// Kiểm tra xem cột đã tồn tại chưa
if (!$schema->getTable('dtb_base_info')->hasColumn('email05')) {
$this->addSql("ALTER TABLE dtb_base_info ADD email05 VARCHAR(255) DEFAULT '' NOT NULL");
}
}
public function down(Schema $schema): void
{
// Xóa cột khi rollback
if ($schema->getTable('dtb_base_info')->hasColumn('email05')) {
$this->addSql('ALTER TABLE dtb_base_info DROP COLUMN email05');
}
}
}