michaeldrennen/Geonames

"violation: 1071 Specified key was too long"

Closed this issue · 3 comments

Hi!
I'm trying to install your package and I am getting stuck on the migration.
I have tried the appservice provider fix

use Illuminate\Support\Facades\Schema;
use Illuminate\Support\ServiceProvider;


class AppServiceProvider extends ServiceProvider
{
    /**
     * Register any application services.
     *
     * @return void
     */
    public function register()
    {
        //
    }

    /**
     * Bootstrap any application services.
     *
     * @return void
     */
    public function boot()
    {
        Schema::defaultStringLength(191);
    }
}

Ive even tried changing the database engine to innodb

'mysql' => [
            'driver' => 'mysql',
            'url' => env('DATABASE_URL'),
            'host' => env('DB_HOST', '127.0.0.1'),
            'port' => env('DB_PORT', '3306'),
            'database' => env('DB_DATABASE', 'forge'),
            'username' => env('DB_USERNAME', 'forge'),
            'password' => env('DB_PASSWORD', ''),
            'unix_socket' => env('DB_SOCKET', ''),
            'charset' => 'utf8mb4',
            'collation' => 'utf8mb4_unicode_ci',
            'prefix' => '',
            'prefix_indexes' => true,
            'strict' => true,
            'engine' => 'InnoDB',
            'options' => extension_loaded('pdo_mysql') ? array_filter([
                PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'),
            ]) : [],
        ],

I was hoping maybe you might have an idea?

I did more research and I believe it is because of this line in your migration table.

$table->engine = 'MyISAM';

It seems that when the error is: "Specified key was too long; max key length is 1000 bytes" that 1000 always points back to the MyISAM table.

Scroll to the bottom of this page: https://github.com/michaeldrennen/Geonames
Read the "Gotcha"

I did try that fix in the gotcha, like I said above, and still wasn't working.