Migration fails when point column gets a SRID and "after" is used #31543
Closed
Description
- Laravel Version: 6.16.0
- PHP Version: 7.2.17
- Database Driver & Version: MySQL 8.0.16
Description:
The SQL statement is built incorrectly when a point column should be added with a SRID and after another column.
Actual SQL:
alter table `test` add `location` point not null after `id` srid 4326;
Correct SQL:
alter table `test` add `location` point not null srid 4326 after `id`;
The error message:
SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'srid 4326' at line 1 (SQL: alter table
test
addlocation
point not null afterid
srid 4326)
Steps To Reproduce:
Schema::create('test', function (Blueprint $table) {
$table->bigIncrements('id');
});
Schema::table('test', function (Blueprint $table) {
$table->point('location', 4326)->after('id');
});