Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[6.x] Fix mysql schema for srid (point) #31852

Merged
merged 1 commit into from
Mar 9, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Illuminate/Database/Schema/Grammars/MySqlGrammar.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class MySqlGrammar extends Grammar
*/
protected $modifiers = [
'Unsigned', 'Charset', 'Collate', 'VirtualAs', 'StoredAs', 'Nullable',
'Default', 'Increment', 'Comment', 'After', 'First', 'Srid',
'Srid', 'Default', 'Increment', 'Comment', 'After', 'First',
];

/**
Expand Down
20 changes: 20 additions & 0 deletions tests/Database/DatabaseMySqlSchemaGrammarTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -898,6 +898,26 @@ public function testAddingPoint()
$this->assertSame('alter table `geo` add `coordinates` point not null', $statements[0]);
}

public function testAddingPointWithSrid()
{
$blueprint = new Blueprint('geo');
$blueprint->point('coordinates', 4326);
$statements = $blueprint->toSql($this->getConnection(), $this->getGrammar());

$this->assertCount(1, $statements);
$this->assertSame('alter table `geo` add `coordinates` point not null srid 4326', $statements[0]);
}

public function testAddingPointWithSridColumn()
{
$blueprint = new Blueprint('geo');
$blueprint->point('coordinates', 4326)->after('id');
$statements = $blueprint->toSql($this->getConnection(), $this->getGrammar());

$this->assertCount(1, $statements);
$this->assertSame('alter table `geo` add `coordinates` point not null srid 4326 after `id`', $statements[0]);
}

public function testAddingLineString()
{
$blueprint = new Blueprint('geo');
Expand Down