Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cant create migration phinx

Tags:

php

mysql

phinx

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
like image 471
Сергей Уфимцев Avatar asked Jul 23 '17 07:07

Сергей Уфимцев


Video Answer


1 Answers

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.

like image 147
Marl Avatar answered Sep 22 '22 07:09

Marl