Skip to content

DeviceGrant table definition breaks in Oracle 19c env #1656

@hvschantz

Description

@hvschantz

Describe the bug

migration 0013_alter_application_authorization_grant_type_device.py fails with error:

oracledb.exceptions.DatabaseError: ORA-02261: such unique or primary key already exists in the table
The cause seems to be that in the DeviceGrant, device_code is defined as:
('device_code', models.CharField(max_length=100, unique=True)),
and then there is a separate constraint defined on the same column:
'constraints': [models.UniqueConstraint(fields=('device_code',), name='oauth2_provider_devicegrant_unique_device_code')],
which causes the Oracle db to throw the above error.

( with PostgreSQL, the code works as expected, this seems to be specific to Oracle )

To Reproduce

env:
Python: 3.12
Django: 5.2
python-oracledb: 3.4.2
Oracle db version: 19c

run manage.py migrate

--> gives stack trace with above error

Expected behavior

the migration should be applied successfully ;)

Version

3.2.0

  • I have tested with the latest published release and it's still a problem.
  • I have tested with the master branch and it's still a problem.

Additional context

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions