D
D
Dmitry2017-09-23 17:57:25
Django
Dmitry, 2017-09-23 17:57:25

How to sync Django base and migrations?

Explain to the illiterate.
Developed a project locally.
Work -> migrations -> Work -> migrations -> ... = Code + Base dump.
I upload the project to the server, and the virtualenv on the server is rebuilt using pip and the prescribed packages from requirements.txt .
Those. it turns out that all applications out of the box contain only initial migrations, and my published database already contains all the migrations that I applied locally during development.
How to live on? How to synchronize database, local and server migrations?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
neatsoft, 2017-09-23
@dimanjy

Information about applied migrations is stored in the database itself (the django_migrations table). Therefore, if the migration scripts have not been manually changed or deleted, then there will be no problems with the deployment. Moreover, further changes to the database structure can be easily rolled out using python manage.py migrate - this is the beauty of migrations.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question