| @@ 5-20 (lines=16) @@ | ||
| 2 | ||
| 3 | namespace MuhmdRaouf\LaravelParatest\Database\Schema\Grammars; |
|
| 4 | ||
| 5 | class MySQL implements SQL |
|
| 6 | { |
|
| 7 | public function compileCreateDatabase(array $options): string |
|
| 8 | { |
|
| 9 | $database = $options['database']; |
|
| 10 | $charset = $options['charset']; |
|
| 11 | $collation = $options['collation']; |
|
| 12 | ||
| 13 | return "CREATE DATABASE IF NOT EXISTS `$database` CHARACTER SET `$charset` COLLATE `$collation`;"; |
|
| 14 | } |
|
| 15 | ||
| 16 | public function compileDropDatabase(string $database): string |
|
| 17 | { |
|
| 18 | return "DROP DATABASE IF EXISTS `$database`;"; |
|
| 19 | } |
|
| 20 | } |
|
| 21 | ||
| @@ 5-20 (lines=16) @@ | ||
| 2 | ||
| 3 | namespace MuhmdRaouf\LaravelParatest\Database\Schema\Grammars; |
|
| 4 | ||
| 5 | class PgSQL implements SQL |
|
| 6 | { |
|
| 7 | public function compileCreateDatabase(array $options): string |
|
| 8 | { |
|
| 9 | $database = $options['database']; |
|
| 10 | $charset = $options['charset']; |
|
| 11 | $collation = $options['collation'] ?? 'en_US.utf8'; |
|
| 12 | ||
| 13 | return "CREATE DATABASE `$database` ENCODING '$charset' LC_COLLATE '$collation';"; |
|
| 14 | } |
|
| 15 | ||
| 16 | public function compileDropDatabase(string $database): string |
|
| 17 | { |
|
| 18 | return "DROP DATABASE IF EXISTS `$database`;"; |
|
| 19 | } |
|
| 20 | } |
|
| 21 | ||