cakephp / migrations

CakePHP database migrations plugin
Other
137 stars 115 forks source link

Allow namespaced migration files #475

Open dereuromark opened 3 years ago

dereuromark commented 3 years ago

I wonder if we could use https://github.com/cakephp/phinx/issues/1820 to namespace our migration classes They are the only code I still have to exclude from sniffers so far:

FOUND 2 ERRORS AFFECTING 1 LINE
----------------------------------------------------------------------------------------------------------------------------------------
 6 | ERROR | Class name "MigrationLanguages" doesn't match filename, expected "20201014000218_MigrationLanguages"
 6 | ERROR | Each class must be in a namespace of at least one level (a top-level vendor name)

With the namespace way it would also probably be a bit cleaner and less conflicting regarding the names.

Right now I always prefix them with Migration to avoid naming clashes/collisions with existing top level classes.

dereuromark commented 3 years ago

The CS issue is "hacked" for now with https://github.com/cakephp/cakephp-codesniffer/pull/320

We should still looking into a phinx solution that allows namespace migration class names, though. According to https://github.com/cakephp/phinx/blob/master/docs/en/namespaces.rst#psr-4-compliance this should already be possible, maybe sth for Cake 4.2+?