【问题标题】:How to Modify a column of a table with Propel Migration and Symfony如何使用 Propel Migration 和 Symfony 修改表的列
【发布时间】:2012-06-22 12:06:13
【问题描述】:

我在 symfony 项目中的推进迁移遇到了一个大问题。第一次尝试修改表格的一列,但在 CLI 上总是出现以下错误:

$ php symfony propel:up
>> propel    Executing migration PropelMigration_1340354091 up
>> Failed to execute SQL "ALTER TABLE `AEX_PROJECT` MODIFY `DESCRIPTION` VARCHAR(200)". Aborting migration. ...

我的 getUpSql() 方法如下所示:

        public function getUpSQL()
        {   
            return array (
      'propel' => '
    # This is a fix for InnoDB in MySQL >= 4.1.x
    # It "suspends judgement" for fkey relationships until all tables are set.
    SET FOREIGN_KEY_CHECKS = 0;

    ALTER TABLE `AEX_PROJECT` MODIFY `DESCRIPTION` VARCHAR(2000);                           

    # This restores the fkey checks, after having unset them earlier
    SET FOREIGN_KEY_CHECKS = 1;
    ',
);
}

我的想法已经不多了。我还尝试了 ALTER COLUMN 或 CHANGE。我还尝试了不同类型的逗号(例如 ' 或 " 或没有逗号)。如果我通过 PhpMyAdmin 而不是通过 Propel Migration 运行迁移,它可以工作。

我想知道 Propel 中是否存在与此相关的已知错误。我能以某种方式解决这个问题吗?

【问题讨论】:

    标签: php mysql symfony1 migration propel


    【解决方案1】:

    我认为这是一个非常基本的错误,您传递的是 varchar(2000),这肯定是不可接受的 :) 使用 varchar(255) 或使用文本,查看文档中的文本

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-11-30
      • 2011-06-24
      • 2011-09-25
      • 1970-01-01
      相关资源
      最近更新 更多