laravel 6.x (SQLSTATE[42000]: Syntax error or access violation: 1075 Incorrect table definition; there can be only one auto column and it must be defined as a key )

0

Mam taki problem próbuje w laravelu 6.x odpalić migracje ale dostraje komunikat

SQLSTATE[42000]: Syntax error or access violation: 1075 Incorrect table definition; there can be only one auto column and it must be defined as a key 

Moja migracje jest taka.

public function up()
    {
        Schema::create('users', function (Blueprint $table) {
            $table->engine = 'InnoDB';
            $table->increments('id');
            $table->string('login');
            $table->string('password');
            $table->rememberToken();
            $table->timestamps();
        });
        Schema::create('products', function (Blueprint $table) {
            $table->engine = 'InnoDB';
            $table->bigIncrements('id');
            $table->string('name');
            $table->integer('how_carolier')->unsigned();
            $table->rememberToken();
            $table->timestamps();
        });
        Schema::create("registration",function (Blueprint $table) {
            $table->engine = 'InnoDB';
            $table->bigIncrements('id')->unsigned();
            $table->datetime('date');
            $table->integer('sugar_measurement',2)->unsigned();
            $table->integer('how_much',2)->unsigned();
            $table->integer("id_users");
            $table->foreign("id_users")->references("id")->on("users");
            $table->integer('what_food')->unsigned();
            $table->rememberToken();
            $table->timestamps();
        });
    }
    

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

Tez manipulowałem i zmieniałęm na $table->increments('id'); tylko bez rezultatu

0

Już patrzełem i to nie to to musi być związane z nowszą wersją 6.x laravela.

2

https://github.com/laravel/framework/blob/6.x/src/Illuminate/Database/Schema/Blueprint.php#L667
Tu masz najnowszą wersję i to dokładnie ten problem co w poprzednim linku. Zmień

$table->integer('sugar_measurement',2)->unsigned();
$table->integer('how_much',2)->unsigned();

na

$table->integer('sugar_measurement')->length(2)->unsigned();
$table->integer('how_much')->length(2)->unsigned();
1

A po co Ci "rememberToken" w innych tabelach niż Users?

0

Ja tak odruchowo to dodaje.

1 użytkowników online, w tym zalogowanych: 0, gości: 1