Is it possible to remove schemamigrations from the Queue? For example. When I run the command ./manage.py migrate --list, it returns a list of all migrations including items that have yet to be migrated.
I have 5 items that have not been migrated yet, but I do not want to migrate 2 of them because I know they will throw an error.
Is is possible to remove those migrations from the 'queue' so to speak?
Thanks!
答案 0 :(得分:1)
从yourapp/migrations
删除相应的文件。调用
python manage.py makemigrations
这些文件的名称类似于0001_initial.py
。
如果没有文件,调用
时没有任何反应python manage.py migrate
模型准备就绪后,您可以为数据库创建新的迁移。
答案 1 :(得分:0)
运行migrate
时,应使用--fake
选项将这些迁移标记为已应用。