6

When I try create migration I get this exception, but I have not got curly braces in my migration path

[Exception] You probably used curly braces to define the migration path in your Phinx configuration file, but no directories have been matched using this pattern. You need to create a migration directory manually.

My config:

paths:
  migrations: %%PHINX_CONFIG_DIR%%/db/migrations
  seeds: %%PHINX_CONFIG_DIR%%/db/seeds

environments:
  default_migration_table: phinxlog
  default_database: development
  production:
    adapter: mysql
    host: localhost
    name: production_db
    user: root
    pass: ''
    port: 3306
    charset: utf8

  development:
    adapter: mysql
    host: localhost
    name: development_db
    user: root
    pass: ''
    port: 3306
    charset: utf8

  testing:
    adapter: mysql
    host: localhost
    name: testing_db
    user: root
    pass: ''
    port: 3306
    charset: utf8

version_order: creation
ansidev
  • 361
  • 1
  • 3
  • 17

4 Answers4

11

Just came across this same error when trying to setup CakePHP & Phinx. Was caused by missing out the directory when running the Phinx command. Docs say to init the system type :

phinx init .

(If Phinx was installed via composer use : vendor/bin/phinx init . )

If you miss out the '.' you get the error you have described. It looks like Phinx doesn't have a default setting of using the currently working directory. http://docs.phinx.org/en/latest/commands.html#the-init-command. You can fix the issue by ether re-running the Phinx command or by manually creating the folders :

mkdir -p db/migrations db/seeds

Hope this helps anyone searching in the future.

Marl
  • 169
  • 1
  • 7
7

Not sure if you ever found your answer, but I fixed this error by manually creating the db/migrations directory in the root. You might have to do the same with db/seeds.

MemUya
  • 347
  • 3
  • 13
  • 1
    The documentation says you have to create `db/migrations` then run `vendor/bin/phinx init`, then `vendor/bin/phinx create ...` – TheRealChx101 Oct 18 '18 at 00:12
0

Probably you are running "php vendor/bin/phinx " from inside the migration directory. Try this from root directory. I was getting same error and fixed from root folder.

0

If you are using CakePHP 3.0 or 4.0 your paths might need updating..

    'paths' => [
        'migrations' => '%%PHINX_CONFIG_DIR%%/config/Migrations',
        'seeds' => '%%PHINX_CONFIG_DIR%%/config/Seeds'
    ],

Worked for me.

Paul Trimor
  • 320
  • 3
  • 15