我在迁移时遇到了这个错误。有什么办法可以在我的数据库中保存数据。我知道删除 auth_user 表可以解决这个问题。我正在运行 postgresql。谢谢!
FATAL ERROR - The following SQL query failed: ALTER TABLE "api_poi" ADD CONSTRAINT "user_id_refs_id_20f256ff" FOREIGN KEY ("user_id") REFERENCES "auth_user" ("id") DEFERRABLE INITIALLY DEFERRED;
The error was: insert or update on table "api_poi" violates foreign key constraint "user_id_refs_id_20f256ff"
DETAIL: Key (user_id)=(1) is not present in table "auth_user".
Run Code Online (Sandbox Code Playgroud)
有一行api_poi已user_id设置为 1,但没有行auth_user已id设置为 1。
因此不可能像您尝试那样定义外键约束。
您必须添加行auth_user或从中删除行api_poi,直到满足外键约束。
| 归档时间: |
|
| 查看次数: |
8536 次 |
| 最近记录: |