Doctrine Migrations - 自定义文件名

问题描述

是否可以制作用于学说迁移的自定义文件名?

AbstractMigration 类中有一个输出任何内容getDescription 方法

https://github.com/doctrine/migrations/blob/1.6/lib/Doctrine/DBAL/Migrations/AbstractMigration.php

如果没有简单的方法使用自定义迁移文件名,那么如何在控制台中输出 getDescription 中的字符串?

namespace Migrations;

use Doctrine\DBAL\Migrations\AbstractMigration;
use Doctrine\DBAL\Schema\Schema;

/**
 * Auto-generated Migration: Please modify to your needs!
 */
class Version20210113092848 extends AbstractMigration
{
    public function getDescription()
    {
        return 'This just will not be showed anywhere,is this working?';
    }

    /**
     * @param Schema $schema
     */
    public function up(Schema $schema)
    {
        // this up() migration is auto-generated,please modify it to your needs
        // executes sql query
    }

    /**
     * @param Schema $schema
     */
    public function down(Schema $schema)
    {
        // this down() migration is auto-generated,please modify it to your needs
        // rollbacks sql query
    }
}

注意:在这种情况下,对于需要重构的旧系统(使用 PHP 5.6),我需要使用 Symfony 之外的学说迁移库作为独立库,并使用支持 PHP 5.6 的 1.5.0 版本。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)