I am deploying my Django site on to Google Cloud. One of the step is to change the database to postgresSQL. As I am using SqlLite locally I wanted to migrate all of the database into postgresSql. I followed an online guide where you Dump your data first and then change Database in settings.py to your new database. I have done everything upto this command;
python manage.py loaddata datadump.json
where datadump.json is the dumped database from SQLITE. Now I am stuck with this error
django.db.utils.IntegrityError: Problem installing fixtur, Could not
load users.Profile(pk=3): duplicate key value violates unique
constraint "users_profile_user_id_key" DETAIL: Key (user_id)=(1) already exists.
and I don't have any idea as to what to do. Some answers I looked up such as this:
postgresql duplicate key violates unique constraint
AND
Django admin "duplicate key value violates unique constraint" Key (user_id)=(1) already exists
haven't helped, as I cannot understand what's going on. I did use MySQL 6 years ago, but I cannot understand this.
I managed to run some SQL commands from online resources and managed to produce this for my database:
!https://i.stack.imgur.com/Yb9ns.jpg
I followed these guides:
https://medium.com/@aaditya.chhabra/how-to-use-postgresql-with-your-django-272d59d28fa5
https://www.shubhamdipt.com/blog/django-transfer-data-from-sqlite-to-another-database/