Laravel-permission: Installation : "nothing to migrate"

Created on 18 Oct 2017  路  17Comments  路  Source: spatie/laravel-permission

Hello,
I was running the installation command, but when running the migrate command, the answer was nothing to migrate.
After checking, nothing new in the database/migrations directory, the create_permission_tables.php.stub was not copied.

I manually copied the file to the migrations directory to finish the installation, but I thought it would be useful to report this.

I searched my whole project, no class CreatePermissionTables declared, except in the stub file.

Just in case, here is partially my composer.json:

"require": {
"php": ">=7.0",
"barryvdh/laravel-debugbar": "2.4.3",
"barryvdh/laravel-ide-helper": "2.4.1",
"ckeditor/ckeditor": "dev-full/4.6.x",
"davejamesmiller/laravel-breadcrumbs": "3.0.3",
"guzzlehttp/guzzle": "6.3.0",
"laravel/framework": "5.4.36",
"laravel/tinker": "1.0.2",
"laravelcollective/html": "5.4.9",
"spatie/laravel-permission": "2.7.1",
"twbs/bootstrap": "3.3.7"
},
"require-dev": {
"fzaninotto/faker": "1.7.1",
"laravel/dusk": "1.1.0",
"mockery/mockery": "0.9.9",
"phpunit/phpunit": "5.7.*"
},

Most helpful comment

try php artisan config:clear

All 17 comments

Did you run the publish command?

php artisan vendor:publish --provider="Spatie\Permission\PermissionServiceProvider" --tag="migrations"

Yes, I followed the install instructions step by step. Here is my command log:

php.exe C:pathtoprojectartisan vendor:publish --provider="SpatiePermissionPermissionServiceProvider" --tag="migrations"
Publishing complete.
Process finished with exit code 0 at 15:30:25.
Execution time: 1聽250 ms.
php.exe C:pathtoprojectartisan migrate
Nothing to migrate.

@Pulsahr.
Can you add php to your path file.

And to your project directory and try to do

php artisan vendor:publish --provider="SpatiePermissionPermissionServiceProvider" --tag="migrations"

and can you confirm if there is that permission service provider on that project > vendor> spatie > permissions.

it was working for me properly.

I will try this again tomorrow on a temporary branch, in a raw console instead of phpstorm console. I'll keep you updated.

Maybe the double-quotes are problematic in your environment? Ref #321

but have you cleared config cache. If you have cached the config may be spatie config will not be loaded and it results no migration?

try php artisan config:clear

I tried to reproduce the error, here is the list of command line entered in the Windows powershell with console output, and edit actions:

composer require spatie/laravel-permission

Using version ^2.7 for spatie/laravel-permission
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 0 installs, 1 update, 0 removals
- Updating spatie/laravel-permission (2.7.1 => 2.7.3): Downloading (100%)
Writing lock file
Generating optimized autoload files
> IlluminateFoundationComposerScripts::postUpdate

Edited app.php file to add Spatie\Permission\PermissionServiceProvider::class, in providers.

php artisan vendor:publish --provider="Spatie\Permission\PermissionServiceProvider" --tag="migrations"

Copied File [vendorspatielaravel-permissiondatabasemigrationscreate_permission_tables.php.stub] To [databasemigrations2017_10_24_142942_create_permission_tables.php]
Publishing complete.

php artisan migrate

Aaaaand, everything went fine. I don't know what didn't work first, but it seems everything is ok right now, and I checked, I have the same version on the branch that had the mistake and the test I made.

Sorry for the false alarm.

No thats not your fault . Windows is always like that . Sometimes file name problem sometime quote problem etc. Thats why many devs recommend homestead.

I'm having same issue on Laravel 6.0 and I tried all posted solutions above and none of them fix my problem... Any clue about it?

@HRaza143 clear cache etc?

@shirshak55 it also didn't work.
Up till now I ran following commands.

  • php artisan config:cache
  • php artisan cache:clear
  • php artisan view:clear
  • php artisan route:clear
    create new project for the fifth time, create new database.
    install project in 6.0.2 version and in 5.8.3 version.
    none of them solve my problem

did u followed docs and published the migrations?

What you mean by publishing migrations?

@HRaza143 wrote:

What you mean by publishing migrations?

It is standard practice to publish migrations for packages you install, in order for the required database tables to be created/updated.
The documentation for this package contains an Installation Instructions page, which talks about how to publish the migrations (but the how-to is exactly the same as for any other package).
https://docs.spatie.be/laravel-permission/v3/installation-laravel/

Well I just created a new project, create one migrations file using make:migration command and it didn't work.
Although it was working fine with my previous projects.

UPDATE I install new laravel project in new folder and migrations worked.
But I don't what is the problem with other folder.
I'm using windows 10

Was this page helpful?
0 / 5 - 0 ratings

Related issues

notflip picture notflip  路  3Comments

holymp2006 picture holymp2006  路  4Comments

ionesculiviucristian picture ionesculiviucristian  路  4Comments

vpratfr picture vpratfr  路  4Comments

tripex picture tripex  路  3Comments