feat: implement database management service layer with MySQL driver and API controllers
This commit is contained in:
@@ -448,4 +448,10 @@ class MySqlDriver implements DatabaseDriverInterface, SchemaDiscoveryInterface
|
||||
fclose($handle);
|
||||
return $path;
|
||||
}
|
||||
|
||||
public function createDatabase(string $name, string $charset = 'utf8mb4', string $collation = 'utf8mb4_unicode_ci'): bool
|
||||
{
|
||||
DB::connection($this->connectionName)->statement("CREATE DATABASE `{$name}` CHARACTER SET {$charset} COLLATE {$collation}");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -164,4 +164,12 @@ class DatabaseService
|
||||
{
|
||||
return $this->getDriver()->batchUpdate($table, $changes);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new database.
|
||||
*/
|
||||
public function createDatabase(string $name, string $charset = 'utf8mb4', string $collation = 'utf8mb4_unicode_ci'): bool
|
||||
{
|
||||
return $this->getDriver()->createDatabase($name, $charset, $collation);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user