Make automatic column additions using Laravel migration

In laravel 5.2, can a column be changed to make it auto_increment? I have an identifier column, its primary already, but it is not auto_increment, and I need to do this, how can I do this? I have registers in the table (each of them has a corresponding ID), so I can not delete the registers.

+4
source share
2 answers

Have you tried the method change?

Schema::table('posts', function (Blueprint $table) {
    $table->increments('id')->change();
});

See the column change documentation for more information .

+1
source

doctrine/dbal composer.json.

 Schema::table('users', function ($table) {
        $table->bigIncrements('id');
    });
0

Source: https://habr.com/ru/post/1668449/


All Articles