migrations
migrations copied to clipboard
Support migrations for multiple databases within same project
This is a (multiple allowed):
-
[ ] bug
-
[x] 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
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.
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.
@pabloelcolombiano You still want to follow up on this?