Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

migration create command is not creating required folders #565

Closed
1 of 3 tasks
nook24 opened this issue Sep 28, 2022 · 4 comments · Fixed by #584
Closed
1 of 3 tasks

migration create command is not creating required folders #565

nook24 opened this issue Sep 28, 2022 · 4 comments · Fixed by #584
Labels

Comments

@nook24
Copy link
Contributor

nook24 commented Sep 28, 2022

This is a (multiple allowed):

  • bug

  • enhancement

  • feature-discussion (RFC)

  • CakePHP Version: 4.4.5

  • Migrations plugin version: 3.5.3

  • Bake plugin version (if relevant): 2.8.1

  • Database server (MySQL, SQLite, Postgres): MySQL 8.0.30-0ubuntu0.22.04.1

  • PHP Version: 8.1.2

  • Platform / OS: Ubuntu 22.04.1 LTS

What you did

I noticed that the migration create command is not creating the required folders anymore.
To resolve the issue, i simply created the two folders:

mkdir -p plugins/FooModule/config/Migrations
mkdir -p plugins/FooModule/config/Seeds

Expected Behavior

Create the Migrations and Seeds folder instead of throwing a cryptic error message

Actual Behavior

$ bin/cake migrations create -p FooModule Initial
using migration paths
using seed paths
PHP Fatal error:  Uncaught Exception: You probably used curly braces to define migration path in your Phinx configuration file, but no directories have been matched using this pattern. You need to create a migration directory manually. in /opt/openitc/frontend/vendor/robmorgan/phinx/src/Phinx/Console/Command/Create.php:111
Stack trace:
#0 /opt/openitc/frontend/vendor/robmorgan/phinx/src/Phinx/Console/Command/Create.php(144): Phinx\Console\Command\Create->getMigrationPath()
#1 /opt/openitc/frontend/vendor/cakephp/migrations/src/Command/Phinx/CommandTrait.php(37): Phinx\Console\Command\Create->execute()
#2 /opt/openitc/frontend/vendor/cakephp/migrations/src/Command/Phinx/Create.php(75): Migrations\Command\Phinx\Create->parentExecute()
#3 /opt/openitc/frontend/vendor/symfony/console/Command/Command.php(308): Migrations\Command\Phinx\Create->execute()
#4 /opt/openitc/frontend/vendor/symfony/console/Application.php(1002): Symfony\Component\Console\Command\Command->run()
#5 /opt/openitc/frontend/vendor/symfony/console/Application.php(299): Symfony\Component\Console\Application->doRunCommand()
#6 /opt/openitc/frontend/vendor/symfony/console/Application.php(171): Symfony\Component\Console\Application->doRun()
#7 /opt/openitc/frontend/vendor/cakephp/migrations/src/Command/MigrationsCommand.php(126): Symfony\Component\Console\Application->run()
#8 /opt/openitc/frontend/vendor/cakephp/cakephp/src/Console/BaseCommand.php(189): Migrations\Command\MigrationsCommand->execute()
#9 /opt/openitc/frontend/vendor/cakephp/migrations/src/Command/MigrationsCommand.php(198): Cake\Console\BaseCommand->run()
#10 /opt/openitc/frontend/vendor/cakephp/cakephp/src/Console/CommandRunner.php(334): Migrations\Command\MigrationsCommand->run()
#11 /opt/openitc/frontend/vendor/cakephp/cakephp/src/Console/CommandRunner.php(172): Cake\Console\CommandRunner->runCommand()
#12 /opt/openitc/frontend/bin/cake.php(12): Cake\Console\CommandRunner->run()
#13 {main}
  thrown in /opt/openitc/frontend/vendor/robmorgan/phinx/src/Phinx/Console/Command/Create.php on line 111
@ajibarra
Copy link
Member

@nook24 I have tested and it creates directories correctly for both app and plugin. Could you please check if you have debug set to false since it won't create folders if debug=false

@ajibarra
Copy link
Member

Maybe instead of leaving phinx manage this, we could alert user that folders don't exist and debug is disabled so folders must be created manually. What do you think @markstory?

@nook24
Copy link
Contributor Author

nook24 commented Oct 26, 2022

I didn't know that debug has to be enabled for this. So probably it was not set to true. Is this a new behavior? I manage the debug value through an environment variable which is most of the time not set to true on the CLI to be honest. So I'm wondering that I never noticed this before.

When setting debug=true, everything works as expected.

Would be good if the migration plugin would output a more helpful error message

nook24 added a commit to it-novum/openITCOCKPIT-documentation that referenced this issue Oct 26, 2022
nook24 added a commit to it-novum/openITCOCKPIT-documentation that referenced this issue Oct 26, 2022
@LordSimal
Copy link
Contributor

See #512

nook24 added a commit to it-novum/openITCOCKPIT that referenced this issue Jan 4, 2023
Enable debug mode so that CakePHP will create missing folders
#1446
cakephp/migrations#565
nook24 added a commit to it-novum/openITCOCKPIT that referenced this issue Jan 4, 2023
Enable debug mode so that CakePHP will create missing folders
#1446
cakephp/migrations#565
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants