About Reverse Data Migrations
Set the reverse data migration code to migrations.RunPython.noop
if you want to be able to smoothly migrate forward and backward:
# content/migrations/0002_migrate_data.py
from django.db import migrations
def migrate_data(apps, schema_editor):
...
class Migration(migrations.Migration):
dependencies = [
("content", "0001_initial"),
]
operations = [
migrations.RunPython(
code=migrate_data,
reverse_code=migrations.RunPython.noop,
),
]
Tips and Tricks Programming Django 4.2 Django 3.2 Django 2.2
Also by me
Django Paddle Subscriptions app
For Django-based SaaS projects.
Django App for You
Django GDPR Cookie Consent app
For Django websites that use cookies.
Django App for You