![](/img/trans.png)
[英]Database FAIL - The database schema is not in sync with the current mapping file
[英]The database schema is not in sync with the current mapping file (but it is !)
我只是在我的代碼中修復了一些東西。 我現在正在嘗試驗證我的架構
php bin/console 原則:模式:驗證
Doctrine 告訴我我的映射是正確的,但我的數據庫架構不是。 所以我在做一個
架構:更新 --dump-sql
這一次又一次地導致相同的 ALTER,我已經執行了很多次。
這是 ALTER :
ALTER TABLE migration_versions CHANGE version version VARCHAR(14) NOT NULL;
我做到了(使用--force),實體已經反映了變化:
**
* MigrationVersions
*
* @ORM\Table(name="migration_versions")
* @ORM\Entity
*/
class MigrationVersions
{
/**
* @var string
*
* @ORM\Column(name="version", type="string", length=14, nullable=false)
* @ORM\Id
* @ORM\GeneratedValue(strategy="IDENTITY")
*/
private $version;
我是對的吧? 它的varchar,長度為14 ...
我不認為我在這里犯了一個錯誤,但我可能會遺漏一些東西。
您是否已經驗證了學說配置文件中的server_version
是否正確? (symfony5 中的config/packages/doctrine.yaml
)
它發生在我身上,我用MariaDB的( version 10.4.11-MariaDB - Source distribution
),並在文件中doctrine.yaml
的server_version
參數的值為5.7
。 我更正后,錯誤不再發生。
你也可以檢查這個問題
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.