
State = migration.apply(state, schema_editor)įile "/usr/local/lib/python3.7/site-packages/django/db/migrations/migration.py", line 124, in apply State = self.apply_migration(state, migration, fake=fake, fake_initial=fake_initial)įile "/usr/local/lib/python3.7/site-packages/django/db/migrations/executor.py", line 245, in apply_migration State = self._migrate_all_forwards(state, plan, full_plan, fake=fake, fake_initial=fake_initial)įile "/usr/local/lib/python3.7/site-packages/django/db/migrations/executor.py", line 147, in _migrate_all_forwards Self.fetch_command(subcommand).run_from_argv(self.argv)įile "/usr/local/lib/python3.7/site-packages/django/core/management/base.py", line 323, in run_from_argvįile "/usr/local/lib/python3.7/site-packages/django/core/management/base.py", line 364, in executeįile "/usr/local/lib/python3.7/site-packages/django/core/management/base.py", line 83, in wrappedįile "/usr/local/lib/python3.7/site-packages/django/core/management/commands/migrate.py", line 234, in handleįile "/usr/local/lib/python3.7/site-packages/django/db/migrations/executor.py", line 117, in migrate manage.py dumpdata -exclude auth.permission -exclude contenttypes > db.Docker exec -ti madchap_ddojo_uwsgi_1 bash -c 'python manage.py migrate' INSERT ✔ 12:27:59Īpply all migrations: admin, auditlog, auth, authtoken, contenttypes, custom_field, django_celery_results, dojo, sessions, sites, social_django, tagging, tastypie, watsonĪpplying dojo.0010_auto_20190724_1017.Traceback (most recent call last):įile "/usr/local/lib/python3.7/site-packages/django/core/management/_init_.py", line 381, in execute_from_command_lineįile "/usr/local/lib/python3.7/site-packages/django/core/management/_init_.py", line 375, in execute To fix this problem, make sure to backup the database by excluding contenttypes and auth.permissions tables If you use this database dump to load the fresh database(in another django project), it can be causes IntegrityError (If you loaddata in same database it works fine) When you backup whole database by using dumpdata command, it will backup all the database tables This command will add the user.json file content into the database.This command can be use to load the fixtures(database dumps) into database.Above command output an xml file(user.xml).manage.py dumpdata er -indent 2 -format xml > user.xml You can specify the format using -format optionĬommand supports for following formats(serialization formats)

Example output of above command is belowīy default, dumpdata will format its output in JSON.manage.py dumpdata er -indent 2 > user.json You can use the -indent option to pretty-print the output with a number of indentation spaces manage.py dumpdata -exclude auth.permission > db.json dumpdata (-indent)īy default, dumpdata will output all data on a single line. You can use -exclude option to specify apps/tables which don't need being dumpedįollowing command will dump the whole database with out including auth.permission table content manage.py dumpdata er > user.json dumpdata (-exclude) Following command will dump the content in django er table.manage.py dumpdata admin.logentry > logentry.json Following command will dump only the content in django admin.logentry table.manage.py dumpdata admin > admin.json dumpdata for backup specific table

