Where are Django migrations stored?

devquora
devquora

Posted On: Feb 22, 2018

 

You can think Django Migrations as version control system for your database/Model. It keeps track of changes done in your application Models/Table like adding a field, deleting a model, etc. Migrations in Django are stored as an on-disk format, referred to here as “migration files”. These files are actually just normal Python files with an agreed-upon object layout, written in a declarative style. A basic migration file looks like this:



from django.db import migrations, models

class Migration(migrations.Migration):

    dependencies = [('migrations', '0001_initial')]

    operations = [
        migrations.DeleteModel('Tribble'),
        migrations.AddField('Author', 'rating', models.IntegerField(default=0)),
    ]
	

Further Reading https://docs.djangoproject.com/en/2.0/topics/migrations/

    Related Questions

    Please Login or Register to leave a response.

    Related Questions

    Django Interview Questions

    What does Of Django Field Class types do?

    What does Of Django Field Class types do?..

    Django Interview Questions

    Does Django Follow Architectural pattern?

    Does Django Follow Architectural pattern?..