I just deployed my laravel app to heroku. I am using clearDB as MySQL database. The problem is that my migration files work perfectly locally. But when i try to migrate to clearDB database, instead of auto incrementing my primary keys, it just concatenates the first number 1.
For example instead of incrementing to 1, 2, 3, 4,; it does 1, 11, 111, 1111
This is my migration file
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateRolesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('roles', function (Blueprint $table) {
$table->tinyIncrements('id');
$table->string('name');
$table->string('full_name');
$table->text('description')->nullable();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('roles');
}
}
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateUsersTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('users', function (Blueprint $table) {
$table->id();
$table->unsignedTinyInteger('role_id')->nullable();
$table->foreign('role_id')->references('id')->on('roles');
$table->string('first_name');
$table->string('last_name');
$table->string('username')->nullable();
$table->string('email')->unique();
$table->timestamp('email_verified_at')->nullable();
$table->string('password');
$table->boolean('active')->default(true);
$table->rememberToken();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('users');
}
}