Sobes.tech
Junior — Middle

Selgitage, mis on fiktiivsed migratsioonid Django-s ja millal neid kasutatakse.

sobes.tech AI

Vastus AI-lt

In Django, fake migrations are migrations marked as applied without actual changes to the database. This is useful when:

  • You have manually or with another tool synchronized the database and want Django to "believe" that the migration has already been applied.
  • When transferring a project with an existing database, to avoid reapplying migrations.

Command to create a fake migration:

python manage.py migrate --fake <app_name> <migration_name>

This tells Django that the migration has been completed, but it will not change the database structure.