`dumpdata` dumps primary keys by default which don't exist anymore after
`flush`, so it's expected that such combination of commands fails. You
django-admin dumpdata --natural-foreign --natural-primary
to avoid dumping auto primary keys (see
Closing per TicketClosingReasons/UseSupportChannels.
> Removes all data from the database and **re-executes any post-
synchronization handlers**. The table of which migrations have been
applied is not cleared. If you would rather start from an empty database
and re-run all migrations, **you should drop and recreate the database**
and then run migrate instead.
so `flush` removes all data from the database and **re-executes post-
synchronization handlers** which recreates `ContentType`'s with different