someline / someline-starter

Someline Starter is a PHP framework for quick building Web Apps and Restful APIs, with modern PHP design pattern foundation.
https://starter.someline.com/
839 stars 169 forks source link

Getting error while "php artisan migrate" #83

Closed GaneshKandu closed 5 years ago

GaneshKandu commented 6 years ago

Hi,

Getting Error on php artisan migrate command

only 3 tables are getting created migrations, password_resets, users;

here is output file of php artisan migrate > artisan_migrate.txt full path is removed in output

artisan_migrate.txt

Steps i followed

system environment

Migration table created successfully.

   Illuminate\Database\QueryException  : SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 1000 bytes (SQL: alter table `password_resets` add index `password_resets_email_index`(`email`))

  at vendor/laravel/framework/src/Illuminate/Database/Connection.php:664
    660|         // If an exception occurs when attempting to run a query, we'll format the error
    661|         // message to include the bindings with SQL, which will make this exception a
    662|         // lot more helpful to the developer instead of just the database's errors.
    663|         catch (Exception $e) {
  > 664|             throw new QueryException(
    665|                 $query, $this->prepareBindings($bindings), $e
    666|             );
    667|         }
    668|

  Exception trace:

  1   Doctrine\DBAL\Driver\PDOException::("SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 1000 bytes")
      vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php:143

  2   PDOException::("SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 1000 bytes")
      vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php:141

  Please use the argument -v to see more details.
libern commented 6 years ago

You need to provide max length for any $table->string("column", 188);

vidhi041 commented 5 years ago

After adding Schema::defaultStringLength(191); to AppServiceProvider::boot(), You need to change 'engine' => 'InnoDB', in config/database.php in mysql.

It is working for me !

GaneshKandu commented 5 years ago

thanks @vidhi041 working now

princencu94 commented 4 years ago

@GaneshKandu where did you find the Schema::defaultStringLength(191); code

GaneshKandu commented 4 years ago

@princencu94

app/Providers/AppServiceProvider.php

public function boot()
{
    Schema::defaultStringLength(191);
}

add this in boot function

Muhammadinaam commented 3 years ago

Hi, this is a nice package but I think that the developers have stopped working on it. Maybe you can try this package: https://github.com/Muhammadinaam/speed-admin. It supports Laravel 8+.