0
当我迁移时遇到此错误。是否有任何方法将数据保存在我的数据库中。我知道,删除auth_user表将解决这个问题。我正在运行postgresql。 谢谢!当迁移时,错误键(user_id)=(1)在表“auth_user”中不存在
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".
@Sagar我认为你知道该表不包含所需的数据,因为你建议删除所有内容?这将有助于提及这一点。 –
因为您仍然拥有引用表的表“api_poi”,所以删除'auth_user'不会有帮助。您可以删除引用未在数据库中找到的用户的行,然后约束将成功。 –
但poi表没有引用用户的行 –