As the title states, when the local development environment modifies the model, sometimes it changes several times, and then many migrations files are generated.
But when deployed to the server, how should the server perform changes:
Do not upload migrations files, directly execute makemigrations
Regenerate migrations, and then run migrate
Upload the migrations file during development and then execute it directly migrate
Which one should I choose among the above two methods? Why?
According to the official statement, it should be submitted and
migrate
should be executed directly on the server side without the need to generate it again.Chinese translation:
It is recommended to submit it to the repository.
I am currently not synchronizing to the remote library.
Because the model needs to be modified frequently during the development process, many migration files will be generated, and it is difficult to control the migration without errors;
Before publishing the program, first confirm whether the model is updated. If so, first perform makemigrations and then migrate. Due to local It's been tested, so it's not prone to some weird sync issues.
Why don’t you delete the newly generated changes in migrations before submitting, re-makemigrations and then submit the repository
But locally, adding fields and then deleting them, etc. are some useless operations. In the end, there may be no changes in the database. So these migrations also have to be submitted to the server and run again?