ilyés Tabessi
ilyés Tabessi

Reputation: 67

laravel migration increment column problem

After Deploy my laravel project to cloud (heroku) i noticed that when i trying to add new user or new role or new something .. the column id increment +10 .. for example the first user id = 1 , the second user id = 11

for example this is my roles table :

public function up()
{
    Schema::create('roles', function (Blueprint $table) {
        $table->bigIncrements('id');
        $table->string('name')->unique();
        $table->timestamps();
    });
}

this is my roles table from mysql workbenck

Upvotes: 0

Views: 290

Answers (1)

Ersoy
Ersoy

Reputation: 9586

it is related to auto_increment_increment settings of mysql.

mysql> SHOW VARIABLES LIKE 'auto_inc%';
+--------------------------+-------+
| Variable_name            | Value |
+--------------------------+-------+
| auto_increment_increment | 1     |
| auto_increment_offset    | 1     |
+--------------------------+-------+
2 rows in set (0.04 sec)

Your auto_increment_increment is probably set to 10. you may set to 1 again via executing;

SET @@auto_increment_increment=1;

Please check here

Edit:

Since Heroku uses cleardb; it is not possible to change it while using cleardb. Here is the answer with the explanation

Upvotes: 1

Related Questions