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中是否有這樣的事情?謝謝。