django-redshift-backend
django-redshift-backend copied to clipboard
Autofield Model Field Generates Duplicate Identity Specification in Migration Statement
"id" integer identity(1, 1) NOT NULL PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY
Problem
- When running migrations using
django-redshift-backend
, columns of type AutoField have identity specified twice, resulting in the following error: "multiple default values specified for column "id" of table "table" [ErrorId: 1-63742d45-7a28d2c01ec6ac8032477b89]"
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
}
Thanks. I'm a little stuck on a task right now, so I'll take a look little later.
Hello, I'm running into the same issue as @thefyk, when trying to migrate to redshift. Any updates?
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.
Now django-redshift-backend 4.0.0 has been released.