spatie / laravel-permission

Associate users with roles and permissions
https://spatie.be/docs/laravel-permission
MIT License
12.03k stars 1.76k forks source link

Problem when trying to migrate laravel-permission migrations #2650

Closed R00TR41Z closed 2 weeks ago

R00TR41Z commented 5 months ago

Problem when trying to migrate laravel-permission migrations

Versions

PHP version: 8.3

Database version:

To Reproduce Steps to reproduce the behavior:

Create new laravel project with v10.48.4

composer create-project laravel/laravel:^10

install laravel permission v6.4

composer require spatie/laravel-permission:6.4

publish packege file

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

Here is my example code and/or tests showing the problem in my app:

php artisan migrate

Expected behavior SQLSTATE[HY000]: General error: 1005 Can't create table Laravel.model_has_permissions (errno: 121 "Duplicate key on write or update") (Connection: mysql, SQL: alter table model_has_permissions add constraint model_has_permissions_permission_id_foreign foreign key (permission_id) references permissions (id) on delete cascade)

spatie-permission

Environment (please complete the following information, because it helps us investigate better):

drbyte commented 4 months ago

I can't replicate this. And the test suite, which runs a lot of migrations via fresh installs ... is passing.

What database engine are you using?

parallels999 commented 4 months ago

To me the problem is on seed

spatie-bot commented 2 weeks ago

Dear contributor,

because this issue seems to be inactive for quite some time now, I've automatically closed it. If you feel this issue deserves some attention from my human colleagues feel free to reopen it.