我有这个密码:
$con = $this->em->getConnection();
$query = sprintf(
"ALTER TABLE client RENAME client_%s;
ALTER TABLE client_deduplicate RENAME client;
ALTER TABLE client DROP FOREIGN KEY rem_id;",
date('Ymd'),
date('Ymd')
);
$con->executeQuery($query);
当我试图执行 doctrine:schema:update --force
错误是:
An exception occurred while executing 'ALTER TABLE client ADD CONSTRAIN
T FK_D99D49C4CDEADB2A FOREIGN KEY (rem_id) REFERENCES rem (id)':
SQLSTATE[23000]: Integrity constraint violation: 1022 Can't write;duplicate key
in table '#sql-1_54'
请帮帮我。提前打电话。
1条答案
按热度按时间brqmpdu11#
先放下外键。
您的外键绑定到现有的
client
表,所以只要外键存在,就不能重命名它。