DEV Community

Discussion on: How to migrate data from SQLite to PostgreSQL in Django

Collapse
 
matacino profile image
matacino

This only works for me with a simple example application.
If tried that on a system with CMS and different other applications I have always got duplicate key-issues because "migrate --run-syncdb" did always some migrations (at least on django 2.2).

Also a "manage.py flush" after running "migrate --run-syncdb" did not work because of foreign key-problems.

My solution was taking the SQL-output of "manage.py sqlflush" and adding CASCADE to the truncate-statement and running it in the database and than do a "manage loaddata …"

Regards

Karl