Phinx: How do you namespace migrations?

Created on 22 Jun 2020  路  4Comments  路  Source: cakephp/phinx

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?

docs

Most helpful comment

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.

All 4 comments

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

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Jacco-V picture Jacco-V  路  4Comments

omer-sds picture omer-sds  路  4Comments

elct9620 picture elct9620  路  4Comments

andrewgill-dev picture andrewgill-dev  路  4Comments

Divi picture Divi  路  5Comments