I've searched pretty much everywhere but I wasn't able to find anything.
Is there a command or a procedure to change the name of a table (so inside doctrine annotation) without loosing data?
Basically, something that will produce something like
RENAME TABLE old_table TO new_table;
or
ALTER TABLE old_table RENAME new_table;
MySQL commands taken from here
Should I write manually the migration file with doctrine:migrations:generate
?
Change table name for given entity.
/** @Entity @Table(name="new_table_name") */
class MyEntity { ... }
Generate a new migration.
up()
and down()
methods and replace them with custom SQL (ALTER TABLE ... RENAME TO ...
).Keep in mind that migration generator is meant as utility/semi-automatic tool.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With