更新时间:2023-12-01 22:19:28
Django不知道您要做什么.默认情况下,它将删除旧表并创建新表. 您需要创建一个空迁移,然后使用此操作(您需要自己编写):
Django does not know, what you are trying to do. By default it will delete old table and create new. You need to create an empty migration, then use this operation (you need to write it by yourself):
https://docs.djangoproject.com/en/stable /ref/migration-operations/#renamemodel
类似这样的东西:
class Migration(migrations.Migration):
dependencies = [
('yourappname', '0001_initial'),
]
operations = [
migrations.RenameModel("OldName", "NewName")
]