Files
ECShopX/database/migrations/Version20250813143022.php
2025-12-29 22:14:41 +08:00

30 lines
864 B
PHP
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?php
namespace Database\Migrations;
use Doctrine\Migrations\AbstractMigration;
use Doctrine\DBAL\Schema\Schema as Schema;
class Version20250813143022 extends AbstractMigration
{
/**
* @param Schema $schema
*/
public function up(Schema $schema): void
{
$this->abortIf($this->connection->getDatabasePlatform()->getName() != 'mysql', 'Migration can only be executed safely on \'mysql\'.');
// 添加税率字段到orders_invoice_item表
$this->addSql('ALTER TABLE orders_invoice_item ADD COLUMN invoice_tax_rate VARCHAR(16) NULL COMMENT "发票税率如13%" AFTER amount');
}
/**
* @param Schema $schema
*/
public function down(Schema $schema): void
{
// 回滚:删除税率字段
$this->addSql('ALTER TABLE orders_invoice_item DROP COLUMN invoice_tax_rate');
}
}