I am trying to migrate a database, after modifying the schema in the models.py
file of my app in Django. When I try to migrate using ./manage.py migrate <app-name>
, it gives the following message:
! These migrations are in the database but not on disk:
As I went through the schemamigration_table
and the files, I noticed that for my last schema migration, the file (which added a table and a column in another table successfully) is not present for some reason. Is there any way I could perform my migration without resetting the database?
Yes,
If you are absolutely confident about the migration to have already applied to the database, You can safely use the --fake
option.
./manage.py migrate <app-name> --fake
This would forward the migrations to the most recent migration.
--fake: Records the migration sequence as having been applied, but doesn’t actually run it. Useful for Converting An App.
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句