Cant create migration phinx
Asked Answered
K

4

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
Kiefer answered 23/7, 2017 at 7:6 Comment(0)
S
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.

Succulent answered 17/1, 2018 at 18:59 Comment(0)
K
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.

Keilakeily answered 19/8, 2017 at 6:39 Comment(1)
The documentation says you have to create db/migrations then run vendor/bin/phinx init, then vendor/bin/phinx create ...Toiletry
T
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.

Triazine answered 13/11, 2017 at 11:7 Comment(0)
A
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.

Aerodontia answered 1/10, 2021 at 15:27 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.