New in Symfony 5.1: Automatic schema updates
Some Symfony components (e.g. Cache, Lock, Messenger, etc.) can store their contents in databases using Doctrine ORM. This requires some manual setup to work. For example, to store sessions in the database you must create the table that stores the information.
We're big fans of automation, so we decided to automate all this in Symfony 5.1.
The idea is to implement some event subscribers that listen to advanced Doctrine
Events::onSchemaCreateTable from Doctrine DBAL and
ToolEvents::postGenerateSchema from Doctrine ORM) and inject the SQL code
required to create the database tables needed by each component.
These automatic database tables are generated only when you really need them.
Consider for example the Messenger component. If you configure a Doctrine
transport and run the
make:migration command, the database is created.
Otherwise, nothing will change in your database table. The same happens when using
PdoAdapter from Cache component,
PdoStore from Lock component, etc.
Symfony Docs will be updated soon to reflect this automation and simplify the setup required in some components.
New in Symfony 5.1: Automatic schema updates symfony.com/index.php/blog/new-in-symfony-5-1-automatic-schema-updatesTweet this
Become a certified developer! Exams are online and available in all countries.Register Now
Comments are closed.
To ensure that comments stay relevant, they are closed for old posts.