我有一个带有现有数据库的django项目,我真的想避免转储或中断.我正在尝试安装South但是当我运行我的初始迁移python manage.py migrate示例时,我收到以下错误:
Running migrations for example:
- Migrating forwards to 0001_initial.
> example:0001_initial
! 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 `example_page` CASCADE; []
= DROP TABLE `example_likebydate` CASCADE; []
= DROP TABLE `example_followbydate` CASCADE; []
! The South developers regret this has happened, and would
! like to gently persuade you to consider a slightly
! easier-to-deal-with DBMS.
! NOTE: The error which caused the migration to fail is further up.
Traceback (most recent call last):
...
File "/usr/local/lib/python2.7/site-packages/MySQLdb/connections.py", line 36, in defaulterrorhandler
raise errorclass, errorvalue
_mysql_exceptions.OperationalError: (1050, "Table 'example_page' already exists")
因此,显而易见的解决方案是运行给定的SQL,但我不知道它会做什么,如果它将丢弃表并丢失我的数据,则不想运行它.
在不丢失数据的情况下,我可以选择使这个南迁移工作吗?
解决方法:
如果您的架构已经使用了用于创建0001_inital.py的models.py,那么您应该使用–fake运行初始迁移,以实质上告诉您已经处于架构的版本0001.
标签:mysql,django,django-south 来源: https://codeday.me/bug/20190610/1210319.html
本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享; 2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关; 3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关; 4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除; 5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。