2013-08-30 54 views
0

,當我在一個symfony項目運行php app/console doctrine:schema:update --force我有一個錯誤,我得到以下錯誤:「PHP應用程序/控制檯學說:架構:更新--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 

錯誤是索引名不包裹「`」, 我怎麼能得到它,因此指數名稱始終包裹着「`」?

回答

1

這是一個design decision

For compatibility reasons between all the supported vendors and edge case problems Doctrine 2 does NOT do automatic identifier quoting. This can lead to problems when trying to get legacy-databases to work with Doctrine 2.

假設你現在讓學說名稱索引時,我的建議是手動重命名(或下降)的指數,然後運行架構更新。

相關問題