Skip to content

Commit 2e9d90b

Browse files
authored
fix srid mysql schema (#31852)
1 parent 7d9d0b5 commit 2e9d90b

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

src/Illuminate/Database/Schema/Grammars/MySqlGrammar.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class MySqlGrammar extends Grammar
1616
*/
1717
protected $modifiers = [
1818
'Unsigned', 'Charset', 'Collate', 'VirtualAs', 'StoredAs', 'Nullable',
19-
'Default', 'Increment', 'Comment', 'After', 'First', 'Srid',
19+
'Srid', 'Default', 'Increment', 'Comment', 'After', 'First',
2020
];
2121

2222
/**

tests/Database/DatabaseMySqlSchemaGrammarTest.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -898,6 +898,26 @@ public function testAddingPoint()
898898
$this->assertSame('alter table `geo` add `coordinates` point not null', $statements[0]);
899899
}
900900

901+
public function testAddingPointWithSrid()
902+
{
903+
$blueprint = new Blueprint('geo');
904+
$blueprint->point('coordinates', 4326);
905+
$statements = $blueprint->toSql($this->getConnection(), $this->getGrammar());
906+
907+
$this->assertCount(1, $statements);
908+
$this->assertSame('alter table `geo` add `coordinates` point not null srid 4326', $statements[0]);
909+
}
910+
911+
public function testAddingPointWithSridColumn()
912+
{
913+
$blueprint = new Blueprint('geo');
914+
$blueprint->point('coordinates', 4326)->after('id');
915+
$statements = $blueprint->toSql($this->getConnection(), $this->getGrammar());
916+
917+
$this->assertCount(1, $statements);
918+
$this->assertSame('alter table `geo` add `coordinates` point not null srid 4326 after `id`', $statements[0]);
919+
}
920+
901921
public function testAddingLineString()
902922
{
903923
$blueprint = new Blueprint('geo');

0 commit comments

Comments
 (0)