Thursday, April 23, 2020

Migrate SQLite to Postgres

Dump the existing data
python manage.py dumpdata > datadump.json

When postgres connected, then
python manage.py migrate --run-syncdb

Remove contentype data
python manage.py shell

>>> from django.contrib.contenttypes.models import ContentType
>>> ContentType.objects.all().delete()
>>> quit()

Load json data
python manage.py loaddata datadump.json

No comments: