3π
I understand your situation well and have been in same shoe several times.
Here is what I prefer(/do):
-
I am in branch
bug-fix/surname_degrade
I changed the user data model [which generateduser_migration_005
] and then migrated the DB.
Then my boss came and pointed out that the user is not able to login due to login degrade. -
So I have to switch branch and fix that first.
-
I can rollback the migration[
user_migration_005
] which I have done few moments back. With something like thispython manage.py migrate user_migration_004
-
Switched branch and started working on
hot-fix/login_degrade
-
When I switch back to my previous task , I can just do migration and proceed.
With this procedure I donβt need to delete my all tables or restore old database or anything like that.
I am a newbie, will be extremely happy to hear your thoughts.
1π
The major issue here is that, you database will change everytime You migrate,so either you mantain you database consistency among different branches, or You can do One thing, while using/testing (after declaring all the models)
1) Delete all database tables ( If you have a backup or dummy data )
2) Delete all existing migration files in you branch
3) Create new migrations
4) Migrate to new migrations
The above steps can also be done if the models are re modified, after modification just repeat the steps.
- [Django]-FileField: How to use upload_to with a whitespace in the name and path
- [Django]-Getting a typeError error in django project
- [Django]-Django default foreign key value for users
1π
Run a different test database in each branch.
When you fork the design, fork the database
Make a clone of the database and migrate that.
- [Django]-Django ModelForm CheckBox Widget
- [Django]-How can I do such a typical unittest?
- [Django]-WHAT IS DIFFERENCE BETWEEN get_user_model() ,settings.AUTH_USER_MODEL and USER in django?
- [Django]-Db_table option does not work in Django model
- [Django]-Creating a User Registration Page using MongoEngine
0π
Make sure when you push to git, you include your migrations, that wait when someone else pulls the branch and does a migrate
django knows what changes were made to the database.
- [Django]-Django annotate multiple objects based on multiple fields on a M2M relationship
- [Django]-Django multiple forms with formsets