Home > Software design >  Update column in existing table in Symfony 5.4
Update column in existing table in Symfony 5.4

Time:08-01

[I just want to update column in my existing entity class, but when I migrate to database using php bin/console ..., It's always shows table already exists or column could not be repeated ] What should I do with this problem?

CodePudding user response:

Make sure, what migration are you executing. If you are not sure, you can delete all migrations in migrations folder of your project. And in your database, empty doctrine_migrations table. Then, try to generate and execute migrations again.

CodePudding user response:

You can execute the down action of the migration with bin/console doctrine:migration:execute --down "name_of_the_migration" (where the name of the migration is DoctrineMigrations\VersionXXXXXXXXXXXXXX).Then update what you need and migrate the migration again with the new changes.

  • Related