kodeine / laravel-acl

Light-weight role-based permissions system for Laravel 6+ built in Auth system.
MIT License
786 stars 216 forks source link

Removing the non necessary code to fix constraint incompatibility error on … #261

Closed spathez closed 3 years ago

spathez commented 3 years ago

When running php artisan migrate:refresh, it caused the following error:

Illuminate\Database\QueryException 

  SQLSTATE[HY000]: General error: 3780 Referencing column 'user_id' and referenced column 'id' in foreign key constraint 'role_user_user_id_foreign' are incompatible. (SQL: ALTER TABLE role_user CHANGE user_id user_id INT UNSIGNED NOT NULL)
...

The solution is to remove the down part of this migration.

kodeine commented 3 years ago

This will not remove the table when migrating down. Hence cannot be approved. Please suggest a better approach

spathez commented 3 years ago

This will not remove the table when migrating down. Hence cannot be approved. Please suggest a better approach

Are you sure about that ? That down function only alter a field it has nothing to do with removing the table. I did refresh my database many time with this change successfully. Anyway I switched to another package already but I am sure that people will have the same problem.