3
create table Foo(
userId bigint(20) not null,
KEY `Foo_userId` (`userId`),
CONSTRAINT `Foo_userId` FOREIGN KEY (`userId`) REFERENCES `User` (`id`)
);
如何将键/约束名称从Foo_userId更改为Bar_userId,只更改名称。我知道他们可以先丢弃,然后重新创建它们。我正在寻找一个简单的方法,如mysql更改约束名称,如何?
alter table Foo rename KEY Foo_userId Bar_userId;
alter table Foo rename CONSTRAINT Foo_userId Bar_userId;
在mysql中是否有这样的事情?谢谢。