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

Support migrations for multiple databases within same project #412

Open
1 of 3 tasks
JRDuncan opened this issue Nov 29, 2019 · 3 comments
Open
1 of 3 tasks

Support migrations for multiple databases within same project #412

JRDuncan opened this issue Nov 29, 2019 · 3 comments

Comments

@JRDuncan
Copy link

JRDuncan commented Nov 29, 2019

This is a (multiple allowed):

  • bug

  • enhancement

  • feature-discussion (RFC)

  • CakePHP Version: CakePHP 3

  • Migrations plugin version: .

  • Bake plugin version (if relevant):

  • Database server (MySQL, SQLite, Postgres): N/A

  • PHP Version:

  • Platform / OS:

What you did

Support migrations for multiple databases within same project
Add migration directory as part of database config in app.config
Migration directory is linked to connection
Each migration is placed in directory associated with specific database
user specifies connection when performing migration actions (create, migrate, rollback etc)

Expected Behavior

Support migrations for multiple databases within same project

Actual Behavior

To Do

@markstory markstory added this to the 2.x milestone Dec 2, 2019
@Danoctum
Copy link

This would be insanely useful since it's now a real hassle to 'hack' migrations to work for multiple databases. We use it locally and in the pipeline and had to write custom scripts to enable this.

@pabloelcolombiano
Copy link
Contributor

pabloelcolombiano commented Nov 9, 2020

I find it a very good idea too.

In app.php, a connection would be per default like:

className' => Connection::class,
'driver' => Mysql::class,
'persistent' => false,
'timezone' => 'UTC',
//'encoding' => 'utf8mb4',
'flags' => [],
'cacheMetadata' => true,
'quoteIdentifiers' => false,
'log' => false,
'migrationSources' => [
   CONFIG . 'Migrations',
],

migrationSources could be modified, or extended.

If a source is specified by the bake command, migrationSources get overwritten.
If a plugin is specified, migrationSources are ignored.
If a connection only is specified, or connection is default, migrationSources apply.

If this is matches your expectations, I can give the implementation a try.

@dereuromark
Copy link
Member

@pabloelcolombiano You still want to follow up on this?

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

No branches or pull requests

5 participants