Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not abel to specifie the Database to use in the Migration #739

Open
1 of 3 tasks
Tyqo opened this issue Aug 22, 2024 · 2 comments
Open
1 of 3 tasks

Not abel to specifie the Database to use in the Migration #739

Tyqo opened this issue Aug 22, 2024 · 2 comments

Comments

@Tyqo
Copy link

Tyqo commented Aug 22, 2024

This is a (multiple allowed):

  • bug
  • 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?

@dereuromark dereuromark added this to the 4.x (CakePHP 5) milestone Aug 22, 2024
@dereuromark
Copy link
Member

  -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.

@markstory
Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants