【问题标题】:yii-dbmigrations does not have a method named "performTransactional"yii-dbmigrations 没有名为“performTransactional”的方法
【发布时间】:2011-01-31 00:32:49
【问题描述】:

我在使用最新版本的 yii-dbmigration 时遇到了一个新问题,当我运行迁移时,控制台显示以下消息并且迁移不起作用。

$ ./protected/yiic migrate
Migrations directory: protected/migrations/

=== Applying: m20110123200901_create_eav_table =================================
ERROR: m20110123200901_create_eav_table does not have a method named "performTransactional".

迁移的代码是:

<?php

class m20110123200901_create_eav_table extends CDbMigration {

    public function up() {
      $t = $this->newTable('eav');
      $t->primary_key('id');
      $t->integer('section_id');
      $t->integer('entry_id');
      $t->integer('field_id');
      $t->string('attribute');
      $t->text('value');
      $t->datetime('created_at');
      $t->datetime('updated_at');
      $this->addTable($t);
    }

    public function down() {
      $this->removeTable('eav');
    }

}

有人知道会发生什么吗?

谢谢。

已编辑

大家好, 我找到了问题,但我不知道解决方案。

这个问题出现在 Yii v1.1.7-dev 上,当我使用另一个版本(如 v1.1.5-dev)时,迁移工作正常。

有人知道怎么解决吗?

谢谢。

【问题讨论】:

    标签: php yii yii-extensions


    【解决方案1】:

    好的,我找到了问题和解决方案。

    我使用的是 yii-dbmigration 扩展,并且 yii 从 v1.1.6 开始就实现了迁移,所以当我运行迁移时两个版本发生冲突。

    解决方案是,卸载扩展并使用新的原生迁移。

    关于 yii 原生迁移功能和 yii 扩展 db-migration 的个人看法是,第二个喜欢更简单和优雅的工作,因为它在 up/down 方法上有很好的 oop 实现。

    谢谢

    【讨论】:

    • 很高兴你知道了。我从未使用过该扩展,但我很高兴类似的功能已被纳入核心,这是一个非常好的功能。随意将您的答案标记为正确答案!干杯
    猜你喜欢
    • 2014-02-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-12-16
    • 2015-09-08
    • 2015-04-12
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多