【问题标题】:"php app/console doctrine:schema:update --force" gives a syntax error“php 应用程序/控制台原则:模式:更新 --force”给出了语法错误
【发布时间】:2013-08-30 09:54:14
【问题描述】:

当我在 symfony 项目中运行 php app/console doctrine:schema:update --force 时出现错误,我收到以下错误:

[Doctrine\DBAL\DBALException]                                                                                                                                                   
An exception occurred while executing 'DROP INDEX idx-id ON extra':                                                                                             

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '-id ON extra' at line 1

[Doctrine\DBAL\Driver\Mysqli\MysqliException]                                                                                                                                   
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '-id ON extra' at line 1 

这是产生错误的sql:

DROP INDEX idx-id ON extra

错误是索引名没有用“`”包裹, 我怎样才能得到它,以便索引名称总是用“`”包裹?

【问题讨论】:

    标签: php mysql symfony doctrine-orm dbal


    【解决方案1】:

    这是design decision

    出于所有支持的供应商之间的兼容性原因和边缘情况问题,Doctrine 2 确实进行自动标识符引用。当试图让遗留数据库与 Doctrine 2 一起工作时,这可能会导致问题。

    假设您现在让 Doctrine 为您的索引命名,我的建议是手动重命名(或删除)索引,然后运行架构更新。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多