gpt4 book ai didi

python - django south错误迁移失败

转载 作者:太空宇宙 更新时间:2023-11-04 10:50:07 24 4
gpt4 key购买 nike

任何人都可以在尝试使用 sudo python manage.py migrate core 时向我解释这个错误。谢谢。

(django-env)pc-03:Ares user$ sudo python manage.py migrate core
Running migrations for core:
- Migrating forwards to 0001_initial.
> core:0001_initial
FATAL ERROR - The following SQL query failed: CREATE TABLE `country` (`countryID` varchar(255) NOT NULL PRIMARY KEY, `abbreviation` varchar(15) NOT NULL, `name` varchar(105) NOT NULL, `prefix` varchar(15) NOT NULL, `active` longtext NOT NULL, `created` datetime NULL, `modified` datetime NULL);
The error was: (1050, "Table 'country' already exists")
! Error found during real run of migration! Aborting.

! Since you have a database that does not support running
! schema-altering statements in transactions, we have had
! to leave it in an interim state between migrations.

! You *might* be able to recover with: = DROP TABLE `country` CASCADE; []
= DROP TABLE `company` CASCADE; []
= DROP TABLE `campaign` CASCADE; []
= DROP TABLE `redemptionMethod` CASCADE; []
= DROP TABLE `incentiveCost` CASCADE; []
= DROP TABLE `incentive` CASCADE; []
= DROP TABLE `recipient` CASCADE; []
= DROP TABLE `code` CASCADE; []
= DROP TABLE `redeemed` CASCADE; []

! The South developers regret this has happened, and would
! like to gently persuade you to consider a slightly
! easier-to-deal-with DBMS (one that supports DDL transactions)
! NOTE: The error which caused the migration to fail is further up.
Error in migration: core:0001_initial

最佳答案

错误是不言自明的:“表‘国家’已经存在”,这意味着您已经在数据库中创建了表‘国家’。为避免这种情况,您可以将初始迁移运行为假的:

sudo python manage.py migrate core --fake

关于python - django south错误迁移失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14522083/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com