Skip to content

arpang14/djangomigration

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 

Repository files navigation

Rollback All Migrations for an App If you want to roll back all migrations for an app (resetting it to an unmigrated state), specify zero as the migration name:

python manage.py migrate app_name zero In Django, you can execute custom Python code during a migration by using the RunPython operation. This allows you to write Python code that runs as part of the migration process, such as data migrations or other custom logic.

Rolling back migrations If you want to roll back all migrations for an app (reset it to an unmigrated state), specify zero as the migration name:

python manage.py migrate app_name zero

Data Loss: Rolling back migrations might result in data loss if the migration involves deleting fields, tables, or data.

Irreversible Migrations: If a migration is marked as irreversible (e.g., a RunPython operation without a reverse function), Django will raise an error when you attempt to roll it back.

Backup: Always back up your database before rolling back migrations, especially in production environments.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages