15.7.2 Data Migration for Site

To create a new data migration, we create an empty migration with a custom name, as shown in Example 15.33.

Example 15.33: Shell Code

$ ./manage.py makemigrations --empty --name=sites_data core Migrations for 'core':   0001_sites_data.py:

Our first goal is to determine what dependencies our migration has. The sites app has a single migration, defined in django/contrib/flatpages/migrations in the 0001_initial.py file. We therefore change our dependencies list in Example 15.34.

Example 15.34: Project Code

core/migrations/0001_sites_data.py in 40667a7881

36   class Migration(migrations.Migration): 37 38       dependencies = [ 39           ('sites', '0001_initial' ...

Get Django Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.