#1373 closed defect (fixed)
[patch] magic-removal: MySQL does not support DROP CONSTRAINT
Change History (6)
comment:1 by , 19 years ago
comment:2 by , 19 years ago
I'm having a similar problem. (At the moment worked around by ./manage.py sqlreset app | sed 's/DROP CONSTRAINT/DROP FOREIGN KEY/' | mysql
). I have no idea how to fix it, just thought some confirmation would be good :)
comment:3 by , 19 years ago
Keywords: | mysql constraint foreign added |
---|---|
Severity: | normal → major |
Summary: | magic-removal: MySQL does not support DROP CONSTRAINT → [patch] magic-removal: MySQL does not support DROP CONSTRAINT |
I'm attaching a patch which fixes this problem. It will use the 'get_foreignkey_drop' function from the backend module so different syntax is supported. In MySQL this is ALTER TABLE <table> DROP FOREIGN KEY <name>;.
I took the liberty to also add these functions to the other backends, but I couldn't test those. Although I think it should work fine, might be good to test them ;)
I put severity to major, since this basicly makes the sqlreset for example, not work for MySQL.
by , 19 years ago
Attachment: | fix_drop_foreignkey.diff added |
---|
by , 19 years ago
Attachment: | newfix_drop_foreignkey.diff added |
---|
comment:4 by , 19 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
I'm not attaching this as a patch file because it's a hack, not a fix, but if you just need to get sqlreset and sqlclear working with &!@$# MySQL today, then:
A slightly more granular fix would be to break down this attribute into supports_constraint_add and supports_constraint_drop, then make the appropriate updates in the backend files. The differences between MySQL MaxDB will still need to be addressed, though.