odan / slim4-skeleton

A Slim 4 Skeleton
https://odan.github.io/slim4-skeleton/
MIT License
439 stars 80 forks source link

composer migration:migrate: There are no commands defined in the "migration" namespace #49

Closed BOXNYC closed 3 years ago

BOXNYC commented 3 years ago

I'm having an issue installing via composer on my CentOS 7...

On the last step of "Step 4: Configuration", when I run composer migration:migrate I get an error: "[Symfony\Component\Console\Exception\CommandNotFoundException]
There are no commands defined in the "migration" namespace."

Thanks! -Joe

Edit: I just noticed I'm using PHP version 7.2.34, where in your docs you say minimum 7.3... Could this be the issue?

odan commented 3 years ago

Yes this could be the issue. Because of phpunit 9 the minimum version has been changed to 7.3. See composer.json. So even composer update should fail when using PHP 7.2 and lower.

You could solve this issue by downgrading the phpunit version to v8. Open composer.json and change "phpunit/phpunit": "^9", to "phpunit/phpunit": "^8". Then run composer update and try it again.

BOXNYC commented 3 years ago

Wow, I think this is the fastest issue response I've ever got, thanks!

The composer.json phpunit is set to 8 already?: "require-dev": { ... "phpunit/phpunit": "^7 || ^8", ... },

Also, I never had an issue installing because the the minimum php is 7.2: "require": { "php": "^7.2", ... },

I hope I didn't install the wrong slim4-skeleton?

Thanks!

odan commented 3 years ago

Ok, it looks you have installed v0.14.0 (or older) of the slim4-skeleton. The latest version is v0.16.0, which requires PHP 7.3+ or 8.0. So the PHP version should not be the issue here. In version 0.15.0 the composer commands has been renamed. See here.

You can find all composer scripts in composer.json. I guess in your specific version the command should be composer phinx:migrate

BOXNYC commented 3 years ago

Thanks! I couldn't find the version I'm using, but I changed to phinx and it installed correctly!

It did have an error: Invalid migration file /var/www/sites/api/resources/migrations/schema.php

Also, when I go to the site and login as admin:admin, I get this JS alert error:

DataTables warning: table id=data-table - Invalid JSON response. For more information about this error, please see http://datatables.net/tn/1

Being I used the newest instructions to install this, perhaps I missed something?

Please feel free to just close this issue as fixed and I'll try and figure out this alert error separately.

Thanks again! Great library!

odan commented 3 years ago

It looks like there was a change in phinx. The file schema.php never caused such an issue as far as I know. This looks like a bug to me. I fixed it in the latest version of the project. See changelog here.

It can be solved by moving the schema.php out of the resources/migrations directory to resources/schema. Then open config/phinx.php and add this key:

$phinx['environments']['local'] = [
    // ...
    'schema_file' => __DIR__ . '/../resources/schema/schema.php',
    // ...
];