joselfonseca / lighthouse-graphql-passport-auth

Add GraphQL mutations to get tokens from passport for https://lighthouse-php.com/
https://lighthouse-php-auth.com/
MIT License
228 stars 56 forks source link

Is there anyway to stop the included migration from running? #135

Closed SlyDave closed 3 years ago

SlyDave commented 3 years ago

looking to use this package to bridge passport and lighthouse (it's awesome, thank you).

But having issues with the socialite part of this package, as we have no need/desire to support socialite - it's already a little annoying that it's a dependency of this package. Now the social_providers migration is causing issues :(

Migrating: 2019_11_19_000000_update_social_provider_users_table

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

my current work around is to "publish" this migration into my own migrations folder and put a blank up() and down() method on it, so it runs but doesn't do anything (other than pollute the source code and migrations table in the database of course)

I personally feel that the integration of socialite is something that feels optional, as socialite is another package above and beyond passport. I feels as this package's responsibilities are getting muddied :(

joselfonseca commented 3 years ago

Thanks for the Feedback. @SlyDave In fact you can set the configuration the migrations to false and they won't be published or ran. https://lighthouse-php-auth.com/docs/customization/#ignore-migrations

SlyDave commented 3 years ago

ahhh! I totally missed that. Thank you !

joselfonseca commented 3 years ago

As for socialite, I think we can maybe ask the users to install it if they need to, I haven't actually tested like that but I do think sometimes is not needed. (it actually is here because we need it in most projects).

SlyDave commented 3 years ago

Yeah, I tend to agree, it could be added as a optional dependency, as everything seems to be working just fine without (at the very least, the migration) and we (and maybe others) do not intend to allow socialite signups, it doesn't make sense for our platforms 👍

There is however not too much harm having the dep install.... just need to ensure everyone understands why it's there 🤣

joselfonseca commented 3 years ago

Thanks for using the package, I'll look into the dependency.