Thank you, very helpfull. I used DROP KEY instead of DROP INDEX and it worked.
Using SHOW CREATE TABLE I noted that unique key name don't match with constraint name used in ADD CONSTRAINT clause, but with 'field1' (I guess it's generated internally).
I see that is because I used
ALTER TABLE...
I've tryed, but
ALTER TABLE MyTable
DROP CONSTRAINT UN_MyTable ;
raise a syntax error.
I don't find any "DROP CONSTRAINT" clause in ALTER TABLE syntax in MySql documentation.
Where I'm wrong?
I have an InnoDb table with a named UNIQUE CONSTRAINT. The constraint has been created with an ALTER TABLE script:
ALTER TABLE MyTable
ADD CONSTRAINT UN_MyTable UNIQUE (field1);
Now I need to add field2 to the constraint with an ALTER script to update old databases (I can't drop and...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.