Rename Doctrine Migration Table Name

I searched almost everywhere, but could not find anything.

Is there a command or procedure for changing the table name (so inside the annotation of the doctrine) without losing data?

Basically, something that will create something like

RENAME TABLE old_table TO new_table; 

or

 ALTER TABLE old_table RENAME new_table; 

MySQL commands taken from here

Should I manually write a migration file with doctrine:migrations:generate ?

+5
source share
1 answer
  • Change the table name for this object.

     /** @Entity @Table(name="new_table_name") */ class MyEntity { ... } 
  • Create a new migration.

  • Delete the contents of the up() and down() methods and replace them with custom SQL ( ALTER TABLE ... RENAME TO ... ).

Keep in mind that the migration generator is used as a utility / semi-automatic tool.

+6
source

Source: https://habr.com/ru/post/1239501/


All Articles