Question:

Explain the migration in Django and how you can do in SQL?

Answer:

Migration in Django is to make changes to your models like deleting a model, adding a field, etc. into your database schema.  There are several commands you use to interact with migrations.

  • Migrate
  • Makemigrations
  • Sqlmigrate

To do the migration in SQL, you have to print the SQL statement for resetting sequences for a given app name.

django-admin.py sqlsequencreset

Use this command to generate SQL that will fix cases where a sequence is out sync with its automatically incremented field data.


Keywords:

© 2017 QuizBucket.org