DjangoCon US 2023

Strategies for Handling Conflicts and Rollbacks in Django database migrations
2023-10-17 , Grand Ballroom II-III

Django is a popular web framework that comes with a powerful database migration system. However, managing database schema changes can be a challenging task, especially in complex projects with multiple developers and frequent releases. Conflicts can arise when multiple developers modify the same models or when migration files are applied in the wrong order. Rollbacks are also necessary when migrations fail or need to be reverted.

We will explore different strategies for handling conflicts and rollbacks in Django database migrations, discuss how to prevent conflicts by using tools such as database locking, how to resolve conflicts manually and how to use migration squashing to reduce the number of migration files. Additionally, we will explain how to handle rollbacks by using version control systems and backups.

By attending this talk, attendees will gain a deeper understanding of the challenges involved in managing database migrations in Django and learn practical strategies for handling conflicts and rollbacks. They will be able to apply these strategies in their own projects to improve their development workflow and ensure data integrity.


Managing database migrations in Django can be challenging, especially in large projects with multiple developers and frequent releases. Conflicts can arise when multiple developers modify the same models when migration files are applied in the wrong order or in some cases where fields are faked. Rollbacks are also necessary when migrations fail or need to be reverted.

This talk will explore various strategies for handling conflicts and rollbacks in Django database migrations. The aim is to provide attendees with practical solutions that can help them effectively manage database schema changes in their Django projects.

Some of the strategies that will be discussed in the talk include using database locking to prevent conflicts, resolving conflicts manually by merging migration files, using migration squashing to reduce the number of migration files, and handling rollbacks by using version control systems.

Attendees will learn how to identify and resolve conflicts in their migration files and how to apply best practices to ensure a smooth migration process. They will also gain insights into how to minimize the risk of data loss and downtime during rollbacks.

By the end of the talk, attendees will have a deeper understanding of the challenges involved in managing database migrations and be better equipped to handle conflicts and rollbacks in their Django projects.

I am Abigail Afi Gbadago (mostly called Afi); a software engineer with a passion for community building and sharing my experiences through speaking engagements and articles.

I am an open-source contributor, coach, and speaker in communities and organizations such as OSM, Rails Girls Ghana, Everything Open Source, Django Girls Ghana, Python Ghana and PyLadies Ghana events, where I speak on open-source contributions, opportunities and tools.