Database collations (#489)

* SyncDatabases

* Collation on Create inc WordPress

* Refactored Enum

* Resolve sync issue

* Fix for PostgreSQL

* pint

* reversed enum

* style adjustments

* add unit tests

* style

* fix tests

* more tests

---------

Co-authored-by: Saeed Vaziry <61919774+saeedvaziry@users.noreply.github.com>
Co-authored-by: Saeed Vaziry <mr.saeedvaziry@gmail.com>
This commit is contained in:
Richard Anderson
2025-03-02 16:18:27 +00:00
committed by GitHub
parent 269ee8d962
commit 5a12ed76bb
35 changed files with 585 additions and 19 deletions

View File

@ -14,11 +14,13 @@ public function create(Server $server, array $input): Database
{
$database = new Database([
'server_id' => $server->id,
'charset' => $input['charset'],
'collation' => $input['collation'],
'name' => $input['name'],
]);
/** @var \App\SSH\Services\Database\Database $databaseHandler */
$databaseHandler = $server->database()->handler();
$databaseHandler->create($database->name);
$databaseHandler->create($database->name, $database->charset, $database->collation);
$database->status = DatabaseStatus::READY;
$database->save();
@ -42,6 +44,14 @@ public static function rules(Server $server, array $input): array
'alpha_dash',
Rule::unique('databases', 'name')->where('server_id', $server->id),
],
'charset' => [
'required',
'string',
],
'collation' => [
'required',
'string',
],
];
if (isset($input['user']) && $input['user']) {
$rules['username'] = [