django migrate raise ValueError('The database backend does not accept 0 as a '
来源:互联网 发布:尚趣玩网络武神赵子龙 编辑:程序博客网 时间:2024/05/29 15:34
一、错误来源:
在修改model时,把原model的primary key设置为一个另外的字段,然后想恢复原来的主键id时出现了这个错误。
二、修改:
1、migrate相关的文件的位置: 工程app名/migrations , 工程内容类似下图:
2、具体操作:
第一种修改方式(相当于自己编写或修改python manage.py makemigrations产生的文件):
自己编写migrations的文件,然后执行python manage.py migrate
第二种修改方式:如果只是为了恢复以前的某个状态,删除掉工程app名/migrations下要修改的文件日期后的文件,执行python manage.py migrate
迁移文件源码类似于下面的代码:
class Migration(migrations.Migration): dependencies = [ # 这是指这个文件修改前的上一个版本的文件 ('app', '0014_auto_20160111_1438'), ] operations = [ migrations.RemoveField( # 执行的是删除字段修改,根据你的实际操作决定 model_name='finalwine', # 操作的model name='num', # 操作的字段名 ), migrations.RemoveField( model_name='waitwine', name='num', ), ]
0 0
- django migrate raise ValueError('The database backend does not accept 0 as a '
- django 报错:ValueError: The database backend does not accept 0 as a value for AutoField.
- Python is not installed as a framework. The Mac OS X backend will not be a
- The user specified as a definer (@'''') does not exist
- The user specified as a definer ('root'@'%') does not exist。
- The user specified as a definer ('root'@'%') does not exist
- The user specified as a definer ('root'@'%') does not exist。 .
- The user specified as a definer ('root'@'%') does not exist。
- The user specified as a definer ('XXXXX'@'%') does not exist
- The user specified as a definer ('root'@'%') does not exist
- The user specified as a definer ('monitor'@'%') does not exist
- The user specified as a definer (''@'') does not exist
- The user specified as a definer ('montor'@'%') does not exist
- The user specified as a definer ('test'@'%') does not exist
- The user specified as a definer ('root'@'%') does not exist
- The user specified as a definer ('root'@'%') does not exist
- The user specified as a definer ('root'@'%') does not exist
- The USER specified AS a DEFINER ('lingshi'@'%') does NOT exist
- mos管驱动电路最小门极电阻计算
- 商务英语句型11
- Recyclerview Adapter 的简单封装
- hdoj The Romantic Hero 4901 (DP 位运算) 好题
- 基本动画效果(点赞,长按抖动,播放器转盘,水滴效果)
- django migrate raise ValueError('The database backend does not accept 0 as a '
- 如何使用wifi连接adb,不需要usb线
- MyEclipse 2015破解
- MongoDB usage
- linux下SVN服务器如何搭建和使用
- malloc、calloc、realloc的区别
- 【Android的事件处理】-----基于监听的事件处理
- 七分养护三分维修 关注车辆的生命周期保养
- CocoaPods更新慢的问题