Support Our Site

To ensure we can continue delivering content and maintaining a free platform for all users, we kindly request that you disable your adblocker. Your contribution greatly supports our site's growth and development.

How to Create an Empty Migration File in Django

2 min read

Migrations are an essential part of Django, as they allow you to manage your database schema and ensure that it is consistent with your models. Most migrations capture actual changes to your models, but there are some scenarios where you may need to create an empty migration file.

In this article, we will show you how to create an empty migration file manually in Django. We will also cover the option to provide a custom name for the migration file.


Before proceeding, make sure you have Django installed and your Django project set up.

Creating an empty migration file

Open your terminal or command prompt and navigate to the root directory of your Django project. Then use the following command - 

python makemigrations <app_name> --empty

Replace <app_name> with the name of the app for which you want to create the migration file.

That's all! Django will generate a new empty migration file in the appropriate app's migrations directory.

Providing a Custom Migration Name

Additionally, Django allows you to provide a custom name for the migration file while creating an empty migration.

python makemigrations <app_name> --name <migration_name> --empty

Replace <app_name> with the name of the app, and <migration_name> with your desired name for the migration file.


Empty migration files can be useful in specific scenarios where you need to add migration operations manually without any model changes. In this article, we learned how to create an empty migration file in Django manually.

Additionally, we explored the option to provide a custom name for the migration file, allowing for better organization and readability within your Django project.


Latest Articles

Latest from djangocentral

How to Use Subquery() in Django With Practical Examples

In the realm of web development, Django stands as a powerful and versatile framework for building robust applications. One of the key aspects of developing efficient and optimized web applications is handling database queries effectively. In this article…
Read more →

4 min read

DRF Serializer: Handling OrderedDict and Converting It to a Dictionary or JSON

In Django Rest Framework (DRF) tests, when you access, you might encounter an OrderedDict instead of a regular dictionary. This behavior is intentional and reflects the design of DRF's serialization process.Understanding the Problem The u…
Read more →

3 min read

Django Rest Framework CheetSheet: Mastering API Development

Django Rest Framework (DRF) is a powerful toolkit that makes building robust and scalable web APIs with Django a breeze. Whether you're a seasoned Django developer or a newcomer, having a comprehensive cheat sheet at your disposal can be a game-changer. …
Read more →

5 min read

How to Perform NOT Queries in Django ORM

In Django, performing NOT queries allows you to exclude certain records from the query results based on specific conditions. The NOT operator, represented by the tilde (~) when used in conjunction with the Django ORM's Q object, helps you construct compl…
Read more →

3 min read