I'm new to Laravel and I can't migrate my database. It shows this error how can this be solved
Asked
Active
Viewed 105 times
-5

Rahul Reghunath
- 1,210
- 13
- 23

Ashutosh Shrestha
- 140
- 3
- 11
-
The issue is with your migration SQL file. The error clearly says a key you're adding is too long. Try to reduce that `email` field's length – Máté Jan 11 '18 at 14:27
-
I've downvoted this because (1) there's an image of the error when copy pasting the error was equally simple and (2) there is no relevant code – apokryfos Jan 11 '18 at 14:28
1 Answers
1
The known workaround for this issue is:
Open AppServiceProvider and paste:
Schema::defaultStringLength(191);
within the public function boot()
Note: Ensure you add use Illuminate\Support\Facades\Schema;
beneath the namespace.
Then run php artisan migrate refresh

Option
- 2,605
- 2
- 19
- 29