-
Notifications
You must be signed in to change notification settings - Fork 11.7k
Open
Labels
Description
Laravel Version
12.40.2
PHP Version
8.4.15
Database Driver & Version
Postgres 18.1
Description
On Postgres, it appears that the from() / startingValue() calls in a migration file do not appear to do anything.
I have a very simple migration file with following up() method;
Schema::table('users', function (Blueprint $table) {
$table->bigIncrements('id')
->from(2000)
->change();
});
I do expect something related to alter sequence users_id_seq restart with 2000 as can be seen in;
| return 'alter sequence '.$table.'_'.$command->column->name.'_seq restart with '.$value; |
The same happens if you use a Schema::create() call, like this for example;
Schema::create('users', function (Blueprint $table) {
$table->bigIncrements('id')
->from(100);
});
Based on the previous ::create() statement, the following queries should be sent to the database server;
array:2 [
0 => "create table "users" ("id" bigserial not null primary key)"
1 => "alter sequence users_id_seq restart with 100"
]
Yet the ID autoincrement values still start with 1.
If I execute the query alter sequence users_id_seq restart with 100 or alter sequence users_id_seq restart with 2000, manually through my SQL client, it does work.
Steps To Reproduce
- Create a simple migration like;
Schema::create('users', function (Blueprint $table) {
$table->bigIncrements('id')
->from(100);
});
- Execute it
- Try to insert a row
- The primary ID of the table still starts with 1 instead of the expected 100.
ShadowJonathan