mysqldoctrineflow-framework

Migration exception: alter table --> Column already exists: 1060 Duplicate column name


After doing php flow flow:doctrine:migrate... I got following error:

An exception occurred while executing 'ALTER TABLE user ADD gdisplayname LONGTEXT DEFAULT NULL, ADD tdisplayname LONGTEXT DEFAULT NULL, ADD fdisplayname LONGTEXT DEFAULT NULL': SQLSTATE[42S21]: Column already exists: 1060 Duplicate column name 'gdisplayname'

I tried to remove the already existing column using:

ALTER TABLE user DROP COLUMN gdisplayname;

and then reusing php flow flow:doctrine:migrate

It does not work. How can I remove this errors without the need to dump the whole database and to successfully migrate the database?

Thanks in advance.


Solution

  • If a migration is already applied, you can set it as migrated so Flow won't try to apply it again. First, check which migration is causing the error

    ./flow doctrine:migrationstatus
    

    Then set it as migrated:

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