1

The migration looks like this:

<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateExtensiontablesRegistry extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('extensiontables_registry', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->string('extensiontable_name')->nullable(false);//->unique();
            $table->timestamps();
            $table->unique('extensiontable_name', 'test');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('extensiontables_registry');
    }
}

Now, when I run it, I get the following errors to my cmd:

In Connection.php line 669:

  SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was t
  oo long; max key length is 767 bytes (SQL: alter table `extensiontables_reg
  istry` add unique `test`(`extensiontable_name`))


In Connection.php line 463:

  SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was t
  oo long; max key length is 767 bytes

Why is that? I mean, "test" cant be a too long keyname, can it? I also tried this approach: https://laravel-news.com/laravel-5-4-key-too-long-error

But it didnt help either :(

Narktor
  • 977
  • 14
  • 34
  • Does this answer your question? [Laravel Migration Error: Syntax error or access violation: 1071 Specified key was too long; max key length is 767 bytes](https://stackoverflow.com/questions/42244541/laravel-migration-error-syntax-error-or-access-violation-1071-specified-key-wa) – MCMXCII Feb 25 '20 at 14:26
  • @MCMXCII unfortunately no :/ – Narktor Feb 25 '20 at 14:29
  • which version of laravel are you running ? what's the version of your mysql driver ? are you using mariaDB ? – N69S Feb 25 '20 at 14:33
  • @N69S Im using Laravel Framework Lumen (6.2.0) (Laravel Components ^6.0) according to artisan. Im using MariaDB, yes, latest portable distribution of XAMPP: https://xampp.site/download/xampp-portable/ MariaDB should be this accorind to startup: Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 15 Server version: 10.1.38-MariaDB mariadb.org binary distribution – Narktor Feb 25 '20 at 14:38
  • had the same issue with mariaDB 10.1 and this fixed it https://stackoverflow.com/a/42245921/4369919 – N69S Feb 25 '20 at 14:46
  • @N69S well, as I already said to MCMXCII, this answer so far didnt help me :/ In my E:\aether-backend\app\Providers\AppServiceProvider.php I added the boot() function as described, but nothing changed. Do I need to refresh anything via console or the like before these changes are applied? – Narktor Feb 25 '20 at 14:58

1 Answers1

0

Well, it might not be a "proper" solution, but it worked for me: Just download a version of XAMPP with a more recent distribution of mariaDB, at least one above 10.1 (e.g. 10.2 and so on). Here is a link to a portable XAMPP version with mariaDB 10.4: https://sourceforge.net/projects/xampp/files/XAMPP%20Windows/7.4.2/

Narktor
  • 977
  • 14
  • 34