0
votes

Hello to all Shopware devs.

I am new in Shopware development and I was surprise to see that while Symfony has a "doctrine generate migration" command that auto generate SQL migrations, Shopware does not seem to have this and following the tutorials, it seems that I have to write both the entity definition and the migration SQL to create the corresponding table.

This is painful to do for tables with many fields. Is there any solution to auto-generate it, making sure there is no mistake? Maybe a plugin?

Finally and if not, is it somehow planned on the roadmap?

Thank you all in advance to help me answering this.

1

1 Answers

0
votes

I answer the question for everyone else who comes across this.

Shopware supports now the cli command bin/console dal:create:schema which is generating the Schema from the Entites.

Keep in mind: At the current time in March 2020, this function is still in beta. So double check the generated schema file.

SQL Schema Documentation

This command selects all active entity definitions known to Shopware and tries to create SQL queries on base of the fields. Note: Your plugin has to be activated, otherwise your custom entity definition will not be considered. The queries are outputted into /schema. Search for the correct SQL file and copy the query to your migration file. Note: This command is in beta state and should not be used blindly Double check if the generated SQL query really fits your needs.