"Table 'lab_data.bigdata_resdir' doesn't exist"
No migrations to apply.(即使实际上明明makemigrations成功,并且有许多migrations可以应用)
Your models have changes that are not yet reflected in a migration, and so won’t be applied. Run ‘manage.py makemigrations’ to make new migrations, and then re-run ‘manage.py migrate’ to apply them.
按照提示重新makemigration后migration文件就不会创建新表了,在数据库中表也的确没有新建。
Sounds like your initial migration was faked because the table already existed (probably with an outdated schema):https://docs.djangoproject.com/en/1.7/topics/migrations/#adding-migrations-to-apps
“This will make a new initial migration for your app. Now, when you run migrate,Django will detect that you have an initial migration and that the tables it wants to create already exist, and will mark the migration as already applied.”
Otherwise you would get an no-such-table error.
[No migrations to apply, even though there are migrations to apply]
In MySQL Database delete row ‘app_name’ from the table ‘django_migrations’.
打开mysql command line client, 进入创建好的数据库use databasename; 查看表select * from django_migration; 发现将要执行的迁移脚本的 id 已经添加在表中了,将其删除即可,即删除最新一次app_name对就的id行。
模型类出错,但已经产生迁移文件,所以生成的时候会报错
python manage.py migrate --fake
删除 即可
数据库迁移顺序不对,数据库中的关联关系错乱
针对个人开发,将数据库删除,将所有迁移文件删除,再重新进行迁移命令