2

i've a multy-database project using symfony 4 and i want to make the migrations of my db1 in a folder called for ex : db1Migrations and the same for db2Migrations.

i did some researchs about the subject but all i found is about the symfony2 so i couldn't figure it out how to practice that on symfony 4, i'm new in symfony :)

if just someone could explain to me how that works i would be grateful !

Symfony2 - Change Migration Directory

Migrating multiple databases using doctrine2 with Symfony2

My doctrine.yml

 orm:
    default_entity_manager: main
    entity_managers:

        main:
            connection: main
            mappings:
                Main:
                    is_bundle: false
                    type: annotation
                    dir: '%kernel.project_dir%/src/Entity/Main'
                    prefix: 'App\Entity\Main'
                    alias: Main

        dossier:
            connection: dossier
            mappings:
                Dossier:
                    is_bundle: false
                    type: annotation
                    dir: '%kernel.project_dir%/src/Entity/Dossier'
                    prefix: 'App\Entity\Dossier'
                    alias: Dossier
Zakymfony
  • 31
  • 6

1 Answers1

1

If you are using symfony's DoctrineMigrationBundle: documentation try creating your migrations via console:

php bin/console doctrine:migrations:migrate --em=customer

instead of

 php bin/console doctrine:migrations:migrate

Here is How to Work with multiples Entity Manager and Connections

SpicyTacos23
  • 500
  • 5
  • 16
  • thank's, but that's not the pb, i'm trying to save my "customer_db" migrations in a new folder ! when i run : php bin/console doctrine:migrations:migrate --em=customer the migrations will be saved on the default folder (Migrations) and all i want is to save them in a another path, i want to separate customer migrations and main migrations ! – Zakymfony Aug 05 '19 at 11:36