@@ -61,31 +61,33 @@ public static function connection($name)
61
61
*/
62
62
public static function getSchemaBuilder (Connection $ connection )
63
63
{
64
- $ driver = $ connection ->getDriverName ();
65
-
66
- switch ($ driver ) {
67
- case 'mysql ' :
68
- $ connection ->setSchemaGrammar ($ connection ->withTablePrefix (new MySqlGrammar ()));
69
-
70
- return new MySqlBuilder ($ connection );
71
- case 'mariadb ' :
72
- $ connection ->setSchemaGrammar ($ connection ->withTablePrefix (new MariaDbGrammar ()));
73
-
74
- return new MariaDbBuilder ($ connection );
75
- case 'pgsql ' :
76
- $ connection ->setSchemaGrammar ($ connection ->withTablePrefix (new PostgresGrammar ()));
77
-
78
- return new PostgresBuilder ($ connection );
79
- case 'sqlite ' :
80
- $ connection ->setSchemaGrammar ($ connection ->withTablePrefix (new SQLiteGrammar ()));
81
-
82
- return new SQLiteBuilder ($ connection );
83
- case 'sqlsrv ' :
84
- $ connection ->setSchemaGrammar ($ connection ->withTablePrefix (new SqlServerGrammar ()));
85
-
86
- return new SqlServerBuilder ($ connection );
87
- }
88
-
89
- throw new RuntimeException ('This database is not supported. ' ); // @codeCoverageIgnore
64
+ return match ($ connection ->getDriverName ()) {
65
+ 'mysql ' => new MySqlBuilder (
66
+ $ connection ->setSchemaGrammar (
67
+ $ connection ->withTablePrefix (new MySqlGrammar ())
68
+ )
69
+ ),
70
+ 'mariadb ' => new MariaDbBuilder (
71
+ $ connection ->setSchemaGrammar (
72
+ $ connection ->withTablePrefix (new MariaDbGrammar ())
73
+ )
74
+ ),
75
+ 'pgsql ' => new PostgresBuilder (
76
+ $ connection ->setSchemaGrammar (
77
+ $ connection ->withTablePrefix (new PostgresGrammar ())
78
+ )
79
+ ),
80
+ 'sqlite ' => new SQLiteBuilder (
81
+ $ connection ->setSchemaGrammar (
82
+ $ connection ->withTablePrefix (new SQLiteGrammar ())
83
+ )
84
+ ),
85
+ 'sqlsrv ' => new SqlServerBuilder (
86
+ $ connection ->setSchemaGrammar (
87
+ $ connection ->withTablePrefix (new SqlServerGrammar ())
88
+ )
89
+ ),
90
+ default => throw new RuntimeException ('This database is not supported. ' ), // @codeCoverageIgnore
91
+ };
90
92
}
91
93
}
0 commit comments