feat: implement database management service layer with MySQL driver and API controllers

This commit is contained in:
Ümit Tunç
2026-04-28 20:16:28 +03:00
parent b5282df56f
commit 2e529bb61c
7 changed files with 153 additions and 15 deletions
@@ -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;
}
}
+8
View File
@@ -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);
}
}