Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Delete ForeignKey field fails (-607) column is referenced in index #70

Closed
maxirobaina opened this issue Apr 10, 2017 · 0 comments
Closed
Assignees
Labels
Milestone

Comments

@maxirobaina
Copy link
Owner

maxirobaina commented Apr 10, 2017

When django create a ForeignKey field, if db_index is not explicitly specified, It set by default db_index = True.
This behavior make that django migration module creates an extra index on Foreign Key field. In Firebird adding a foreign key constraints implicitly implies that an index is added.
Then, if delete a foreign key field is required, this operation will fail because Firebird want to delete the related index.

Engine Message :
unsuccessful metadata update
column [COLUMN_NAME] from table [TABLE_NAME is referenced in index [INDEX_NAME]

MySQL has a similar behavior.
https://github.com/django/django/blob/stable/1.8.x/django/db/backends/mysql/schema.py#L54

@maxirobaina maxirobaina self-assigned this Apr 17, 2017
@maxirobaina maxirobaina added this to the 1.8.0 milestone Apr 17, 2017
maxirobaina added a commit that referenced this issue Apr 19, 2017
can_introspect_max_length is True by default in django DatabaseFeatures
django-firebird failed to retrive the correct field length when the charset is UTF8 over a char field type
@maxirobaina maxirobaina modified the milestones: 1.8.0, 1.9.0 Apr 24, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant