jazzband / django-redshift-backend

Redshift database backend for Django
Apache License 2.0
82 stars 47 forks source link

Autofield Model Field Generates Duplicate Identity Specification in Migration Statement #109

Closed thefyk closed 4 months ago

thefyk commented 2 years ago

"id" integer identity(1, 1) NOT NULL PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY

Problem

Procedure to reproduce the problem

Create a model without a primary key field. Run makemigrations followed by migrate.

Expected results

The migration will not run due to the duplicate Identity reference. I suggest changing

redshift_data_types = {
    "AutoField": "integer identity(1, 1)",
    "BigAutoField": "bigint identity(1, 1)",
    "TextField": "varchar(max)",  # text must be varchar(max)
    "UUIDField": "varchar(32)",  # redshift doesn't support uuid fields
}

to

redshift_data_types = {
    "AutoField": "integer",
    "BigAutoField": "bigint",
    "TextField": "varchar(max)",  # text must be varchar(max)
    "UUIDField": "varchar(32)",  # redshift doesn't support uuid fields
}
shimizukawa commented 2 years ago

Thanks. I'm a little stuck on a task right now, so I'll take a look little later.

ldderrick commented 1 year ago

Hello, I'm running into the same issue as @thefyk, when trying to migrate to redshift. Any updates?

shimizukawa commented 4 months ago

This problem has been resolved by #129. This problem occurred when using django-redshift-backend with Django 4.1 or later.

After checking the issues that need to be addressed, we plan to release it as version 4.0.0.

shimizukawa commented 4 months ago

Now django-redshift-backend 4.0.0 has been released.