phinx
phinx copied to clipboard
How do you namespace migrations?
The template references $namespaceDefinition
, which according to the code comes from some config, somewhere. But the config documentation makes no reference to namespaces anywhere (except aliases, which seems unrelated). How does one actually set the migration namespace with config?
You would do:
'paths' => [
'migrations' => [
'Foo\\Test' => '%%PHINX_CONFIG_DIR%%/db/migrations'
],
'seeds' => [
'Foo\\Bar' => '%%PHINX_CONFIG_DIR%%/db/seeds'
]
],
where the key is the namespace and value is the path.
Is it documented?
No, and I agree it should be. The above is as much a note to myself as anyone else who wants to update the docs as it is an immediate answer to your question on how to do it.
I was wondering how to namespace migrations as well, but it looks as though this is already documented in https://github.com/cakephp/phinx/blob/master/docs/en/namespaces.rst, which isn't included in the contents