Last active
August 29, 2015 14:20
-
-
Save lovemyliwu/9f33ba54fddbbd16564a to your computer and use it in GitHub Desktop.
a safe way to re-build empty_db for django
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#prepare db for develop | |
1. ./update_db.sh | |
#prepare code | |
1. git checkout develop | |
2. git pull origin develop | |
3. python manage.py migrate | |
#merge code | |
1. git checkout hotfix | |
2. git merge develop | |
3. git checkout develop -- empty_db.sql | |
4. git rm {new migrate files in this hotfix} | |
5. python manage.py makemigrations | |
6. {select yes to create test db} | |
7. python manage.py migrate | |
#done |
a fast-est way:
direct use develop branch empty_db
- git merge develop
- git checkout develop -- empty_db.sql
- mysql -uroot -ppassword -Dcruise < empty_db.sql
- git rm {new migrate files in this hotfix}
- python manage.py makemigrations
- {select yes to create test db}
if you want test data in cruise db
- python manage.py devdata --action push --populate --settings=cruise2.settings.dev
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
with migrate rollback will faster
rollback db for develop
prepare code
merge code
done