From c9e70ea000349ad22c4d2bdd99bc823f1804880c Mon Sep 17 00:00:00 2001 From: Rodrigo Pedra Brum Date: Mon, 9 Mar 2020 04:13:37 -0300 Subject: [PATCH] fix srid mysql schema --- .../Database/Schema/Grammars/MySqlGrammar.php | 2 +- .../DatabaseMySqlSchemaGrammarTest.php | 20 +++++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/src/Illuminate/Database/Schema/Grammars/MySqlGrammar.php b/src/Illuminate/Database/Schema/Grammars/MySqlGrammar.php index 79a7c80ed454..6464a5d807d4 100755 --- a/src/Illuminate/Database/Schema/Grammars/MySqlGrammar.php +++ b/src/Illuminate/Database/Schema/Grammars/MySqlGrammar.php @@ -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', ]; /** diff --git a/tests/Database/DatabaseMySqlSchemaGrammarTest.php b/tests/Database/DatabaseMySqlSchemaGrammarTest.php index d601176b6073..a21891b7bead 100755 --- a/tests/Database/DatabaseMySqlSchemaGrammarTest.php +++ b/tests/Database/DatabaseMySqlSchemaGrammarTest.php @@ -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');