nowendwell / laravel-terms

A tool for adding terms and conditions to your project
MIT License
23 stars 8 forks source link

change user_id fk to unsignedInteger #10

Closed restgalindo closed 3 years ago

restgalindo commented 3 years ago

Hi, I had an issue when I tried to migrate, I found that user default type does not match with the bigInteger so I changed the type, I think it might due to the mysql engine

SQLSTATE[HY000]: General error: 1215 Cannot add foreign key constraint (SQL: alter table user_terms add constraint user_terms_user_id_foreign foreign key (user_id) references users (id) on delete cascade on update cascade)

This should fix it

nowendwell commented 3 years ago

@restgalindo Unfortunately the "Laravel" way for id columns is the unsigned Big Integer so merging this would break conventions.

Fortunately, in v2 and higher, we allow publishing the migration file before running it. You can customize the migration in the way you need.

You can do this with php artisan vendor:publish --provider="Nowendwell\LaravelTerms\LaravelTermsServiceProvider"