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

I have got this error while migrating a migration file in Laravel to create a tiny integer column.

$table->tinyInteger('order_by', 4)->after('status')->nullable();  

Answers 1
  • Create tiny integer column in Laravel using migration

    //Change from
    $table->tinyInteger('order_by', 4)->after('status')->nullable();
    
    //To 
    $table->tinyInteger('order_by')->after('status')->nullable();
    
    1
  • Back to code snippet queries related laravel