migrations icon indicating copy to clipboard operation
migrations copied to clipboard

Not abel to specifie the Database to use in the Migration

Open Tyqo opened this issue 1 year ago • 2 comments

This is a (multiple allowed):

  • [ ] bug
  • [x] enhancement
  • [ ] feature-discussion (RFC)

Hi, so I am rewriting an older Project with CakePHP an I have been enjoying Migrations. The Problem is, that this Project is using 7 Databases, which won't be a problem with Cake.

But, I can't set the Database for a specific Migration. I can run the Migration with the -c flag, but it still tries to apply all other Migrations to that Database. Am I missing something here? Or is the Migrations Plugin not suitable for multiple Databases?

Tyqo avatar Aug 22 '24 12:08 Tyqo

  -p, --plugin=PLUGIN          The plugin containing the migrations
  -c, --connection=CONNECTION  The datasource connection to use
  -s, --source=SOURCE          The folder where migrations are in

You could try to use -c together with either -s (different source path) or -p (plugin based source separation). That would work I guess.

dereuromark avatar Aug 22 '24 12:08 dereuromark

Am I missing something here? Or is the Migrations Plugin not suitable for multiple Databases?

Migrations can work with multiple databases, but what it doesn't understand is which tables are in which databases. It does however give a few tools for grouping migrations together. Currently we have 'sources' and plugins as ways to create sub-groups of migrations that can be run independently. @dereuromark's suggestion of pairing connections + source directories together could be a good solution for separating migrations for each of your databases.

markstory avatar Aug 22 '24 14:08 markstory