mysql - 迁移异常: alter table --> Column already exists: 1060 Duplicate column name

标签 mysql doctrine flow-framework

完成php flow flow:doctrine:migrate后... 我收到以下错误:

执行“ALTER TABLE user ADD gdisplayname LONGTEXT DEFAULT NULL, ADD tdisplayname LONGTEXT DEFAULT NULL, ADD fdisplayname LONGTEXT DEFAULT NULL”时发生异常: SQLSTATE[42S21]:列已存在:1060 重复列名“gdisplayname”

我尝试使用以下方法删除已经存在的列:

ALTER TABLE user DROP COLUMN gdisplayname;

然后重用php flow flow:doctrine:migrate

它不起作用。如何消除此错误而不需要转储整个数据库并成功迁移数据库?

提前致谢。

最佳答案

如果迁移已应用,您可以将其设置为已迁移,这样 Flow 就不会再次尝试应用它。首先,检查哪个迁移导致了错误

./flow doctrine:migrationstatus

然后将其设置为已迁移:

./flow:doctrine:migrationversion --version <version> --add

关于mysql - 迁移异常: alter table --> Column already exists: 1060 Duplicate column name,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39472899/

相关文章:

php - 将属性添加到关联类 ManyToMany

mysql - 错字3流: "Result could not be converted to string" - get field content of query result

mysql - 如何在 Flow Framework 中打印查询?

php - MySQL 循环选择

php - mysql_real_escape_string 适用于本地主机但不适用于网络服务器

symfony2 Doctrine 选择IFNULL

date - 如何在 Doctrine 查询语言(dql)中获得日期差?

php - 如何为mysql创建DROP INDEX IF EXISTS?

mysql.connector.errors.InterfaceError : Failed parsing EOF packet

mysql - 连接2个涉及同一个表的sql查询,我需要取回id