Using h5p-bundle in a multi-tenant symfony web application
Closed this issue · 2 comments
Hello Guys,
I used this bundle in a default Symfony 5.1 application and works perfect, I think you did a good job.
when I run:
php bin/console doctrine:schema:update --force
Updating database schema...
26 queries were executed
all run perfect in the above command, but when I run the same code in a multi-tenant Symfony 5.1 app this does not work.
php bin/console doctrine:schema:update --force
php bin/console doctrine:schema:update --force --tenant dfvy20201018105607db --verbose
[OK] Nothing to update - your database is already in sync with the current entity metadata.
and tables never were created in the tenant database.
I was thinking(This is only an Idea) if would be possible to extend this bundle and make it something like "FOSUserBundle" where you only create a class that extends of the base class and you can customize the bundle according to our needs(developers).
I know all the enhancements for a bundle require time, I understand this perfectly because I'm also a developer, So I would like help you moving forward this very good project to the next level.
Could you check if improve the bundle to work with Multi-tenant apps is something feasible from your point of view?
Maybe this could help to check the complexity according to my doctrine config file.
` connections:
main:
url: '%env(resolve:DATABASE_URL)%'
driver: 'pdo_mysql'
server_version: 'mariadb-10.3.20'
charset: utf8mb4
default_table_options:
charset: utf8mb4
collate: utf8mb4_unicode_ci
tenant:
driver: 'pdo_mysql'
server_version: 'mariadb-10.3.20'
charset: utf8mb4
default_table_options:
charset: utf8mb4
collate: utf8mb4_unicode_ci
port: '3306'
wrapper_class: App\Doctrine\DBAL\TenantConnection`
Best regards,
Isaac Flores
I was able to map all the entities into my tenant databases doing this in my doctrine.yaml file.
tenant:
connection: tenant
naming_strategy: doctrine.orm.naming_strategy.underscore_number_aware
mappings:
App:
is_bundle: false
type: annotation
dir: '%kernel.project_dir%/src/Entity/Tenant'
prefix: 'App\Entity\Tenant'
alias: App
StuditH5PBundle:
is_bundle: false
type: annotation
dir: '%kernel.project_dir%/vendor/jorisdugue/h5p-bundle/Entity'
prefix: 'Studit\H5PBundle\Entity'
alias: StuditH5PBundle
Normally you can just point your command to use a certain connection
bin/console doctrine:schema:update --connection=tenant
This should run the migrations again.