1👍
✅
From git
point of view, you can do revert
to previous commit.
git revert sha #commit sha of the last commit
OR
git reset --hard HEAD~n #n how many commits to remove.
git push --force
Fixing through django(possible if you didn’t add any migrations later.),
python manage.py makemigrations APP_A --empty
python manage.py makemigrations APP_A
python manage.py migrate --fake
0👍
Unfortunately git revert
didn’t help me. In the end, I solved the problem by executing the following steps:
1.Manually delete all tables related to the “A” app in db.sqlite3.
2.Create new migrations and db.sqlite3 tables from existing schema:
python manage.py makemigrations A --empty
python manage.py makemigrations A
python manage.py migrate
3.Dump the tables data back into db.sqlite3 from a backup:
sqlite3 ~/Backup/A/db.sqlite3 ".dump table_name" | grep -v "CREATE" | sqlite3 db.sqlite3
- Clean() method causes files to lose data using POST form
- Circular Referencing Packages – Python/Django
- Ploting pie chart in django by highcharts
- Detail View is not displaying details of the post? Django
- Django Custom Text Formatting
Source:stackexchange.com