We are migrating our Software from our own and legacy PHP framework to Symfony. Our application has different Schema for every user. So beside public Schema, we have about 2.000 user Schemas. Let's say that we have a system similar to the marketplace, and every user can customize some tables inside their own Schema, but let's not focus on that.
We are currently searching for the best solutions for two problems:
- When a new user is registered, our Symfony should run migrations only for that newly created user Schema.
- When we create migration we need that that migration affects ALL existing user Schemas.
Currently, in our old system, we do these kinds of migration with a bunch of PHP logic, and I would like to avoid customizing DoctrineMigrationsBundle or have hundreds of lines of PHP code in a single migration.
So I would like to know is there any easier way to handle all user Schemas in Doctrine/Symfony, so when I run for example:
php bin/console doctrine:migrations:migrate
all our existing user Schemas are updated.
Our user Schema names are like app234234
, app453453
and except those Schemas we have only default public
Schema
We are using:
- Symfony 4.3
- PostgreSQL 9.1
- PHP 7.3