phinx icon indicating copy to clipboard operation
phinx copied to clipboard

How do you namespace migrations?

Open Bilge opened this issue 4 years ago • 4 comments

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?

Bilge avatar Jun 22 '20 01:06 Bilge

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.

MasterOdin avatar Jun 23 '20 15:06 MasterOdin

Is it documented?

Bilge avatar Jun 23 '20 15:06 Bilge

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.

MasterOdin avatar Jun 23 '20 16:06 MasterOdin

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

jcapcik avatar Jul 10 '20 00:07 jcapcik