I am trying to migrate my Django 2.0.4 project from SQLite to PostgreSQL 10 following the steps described here, but I am having differents problems.
During the project I changed some Integer fields to UUID4 fields.
I managed to run python manage.py migrate --run-syncdb
manually editing auto_increment migration file making changes of this type (see id field):
From
class Migration(migrations.Migration):
dependencies = [
('dumps', '0011_auto_20180608_1714'),
]
operations = [
migrations.CreateModel(
name='Report',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('data', models.DateTimeField(auto_now_add=True, verbose_name='Date')),
],
),
...
...
...
To
class Migration(migrations.Migration):
dependencies = [
('dumps', '0011_auto_20180608_1714'),
]
operations = [
migrations.CreateModel(
name='Report',
fields=[
('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False, verbose_name='ID')),
('data', models.DateTimeField(auto_now_add=True, verbose_name='Date')),
],
),
...
...
...
Next, I commented all auto_increment files in which there was an AlterTable on uuid fields, but when I run python manage.py loaddata datadump.json
I obtain the following error:
django.db.utils.ProgrammingError: Problem installing fixture 'C:\Users\djangoproject\datadump.json': Could not load myApp.Reservation(pk=10d00b08-bf35-469f-b53f-ec28f8b6ecb3): ERROR: column "reservation_id" is integer type but the expression is uuid type
LINE 1: UPDATE "myApp_reservation" SET "reservation_id" = '066cff3c-4b...