diff --git a/src/Illuminate/Database/Schema/Grammars/MariaDbGrammar.php b/src/Illuminate/Database/Schema/Grammars/MariaDbGrammar.php index 3f418c22e6fc..39ae68619127 100755 --- a/src/Illuminate/Database/Schema/Grammars/MariaDbGrammar.php +++ b/src/Illuminate/Database/Schema/Grammars/MariaDbGrammar.php @@ -54,6 +54,17 @@ public function compileRenameColumn(Blueprint $blueprint, Fluent $command, Conne return parent::compileRenameColumn($blueprint, $command, $connection); } + /** + * Create the column definition for a uuid type. + * + * @param \Illuminate\Support\Fluent $column + * @return string + */ + protected function typeUuid(Fluent $column) + { + return 'uuid'; + } + /** * Create the column definition for a spatial Geometry type. * diff --git a/tests/Database/DatabaseMariaDbSchemaGrammarTest.php b/tests/Database/DatabaseMariaDbSchemaGrammarTest.php index 601e7479c568..c78355e4f768 100755 --- a/tests/Database/DatabaseMariaDbSchemaGrammarTest.php +++ b/tests/Database/DatabaseMariaDbSchemaGrammarTest.php @@ -57,7 +57,7 @@ public function testBasicCreateTable() $statements = $blueprint->toSql($conn, $this->getGrammar()); $this->assertCount(1, $statements); - $this->assertSame('create table `users` (`id` char(36) not null, primary key (`id`))', $statements[0]); + $this->assertSame('create table `users` (`id` uuid not null, primary key (`id`))', $statements[0]); } public function testAutoIncrementStartingValue() @@ -1090,7 +1090,7 @@ public function testAddingUuid() $statements = $blueprint->toSql($this->getConnection(), $this->getGrammar()); $this->assertCount(1, $statements); - $this->assertSame('alter table `users` add `foo` char(36) not null', $statements[0]); + $this->assertSame('alter table `users` add `foo` uuid not null', $statements[0]); } public function testAddingUuidDefaultsColumnName() @@ -1100,7 +1100,7 @@ public function testAddingUuidDefaultsColumnName() $statements = $blueprint->toSql($this->getConnection(), $this->getGrammar()); $this->assertCount(1, $statements); - $this->assertSame('alter table `users` add `uuid` char(36) not null', $statements[0]); + $this->assertSame('alter table `users` add `uuid` uuid not null', $statements[0]); } public function testAddingForeignUuid() @@ -1116,7 +1116,7 @@ public function testAddingForeignUuid() $this->assertInstanceOf(ForeignIdColumnDefinition::class, $foreignUuid); $this->assertSame([ - 'alter table `users` add `foo` char(36) not null, add `company_id` char(36) not null, add `laravel_idea_id` char(36) not null, add `team_id` char(36) not null, add `team_column_id` char(36) not null', + 'alter table `users` add `foo` uuid not null, add `company_id` uuid not null, add `laravel_idea_id` uuid not null, add `team_id` uuid not null, add `team_column_id` uuid not null', 'alter table `users` add constraint `users_company_id_foreign` foreign key (`company_id`) references `companies` (`id`)', 'alter table `users` add constraint `users_laravel_idea_id_foreign` foreign key (`laravel_idea_id`) references `laravel_ideas` (`id`)', 'alter table `users` add constraint `users_team_id_foreign` foreign key (`team_id`) references `teams` (`id`)',