django的web框架,Oracle11g数据库
models.py文件中创建新的class,即新的数据库表时执行
python manage.py makemigrations
python manage.py migrate
会报错
django.db.utils.DatabaseError: ORA-00955
或者
django.db.utils.IntegrityError: ORA-00001
这样的错误
解决方案
:
- 删除掉migrations文件夹下的 除了
__init__.py
和0001_initial.py
这两个文件以外的文件 - 去Oracle数据库,plsql,删除掉表django_migrations 中的相关记录,执行的sql语句是
delete from django_migrations where app = '你的django app名字' and name not like '0001%';
- django_migrations 这种表里保存的是makemigrations时的操作。
- 最后执行
python manage.py migrate [你的django app名字]