-
-
Notifications
You must be signed in to change notification settings - Fork 522
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
49e69d1
commit c2afebb
Showing
11 changed files
with
446 additions
and
369 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Kimai time-tracking app. | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace DoctrineMigrations; | ||
|
||
use App\Doctrine\AbstractMigration; | ||
use Doctrine\DBAL\Schema\Schema; | ||
|
||
/** | ||
* @version 2.x | ||
*/ | ||
final class <className> extends AbstractMigration | ||
{ | ||
public function getDescription(): string | ||
{ | ||
return ''; | ||
} | ||
|
||
public function up(Schema $schema): void | ||
{ | ||
<up> | ||
} | ||
|
||
public function down(Schema $schema): void | ||
{ | ||
<down> | ||
}<override> | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Kimai time-tracking app. | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace App\Doctrine; | ||
|
||
use Doctrine\DBAL\Platforms\AbstractPlatform; | ||
use Doctrine\DBAL\Tools\DsnParser; | ||
|
||
final class DsnParserFactory | ||
{ | ||
/** | ||
* Copied here from Doctrine v3 DriverManager, as they are going to be removed in Doctrine 4. | ||
* | ||
* @var array<string, string> | ||
*/ | ||
private static array $driverSchemeAliases = [ | ||
'db2' => 'ibm_db2', | ||
'mssql' => 'pdo_sqlsrv', | ||
'mysql' => 'pdo_mysql', | ||
'mysql2' => 'pdo_mysql', // Amazon RDS, for some weird reason | ||
'postgres' => 'pdo_pgsql', | ||
'postgresql' => 'pdo_pgsql', | ||
'pgsql' => 'pdo_pgsql', | ||
'sqlite' => 'pdo_sqlite', | ||
'sqlite3' => 'pdo_sqlite', | ||
]; | ||
|
||
public function create(): DsnParser | ||
{ | ||
return new DsnParser(self::$driverSchemeAliases); | ||
} | ||
|
||
/** | ||
* @return array<string, array<mixed>|bool|AbstractPlatform|int|string> | ||
*/ | ||
public function parse( | ||
#[\SensitiveParameter] | ||
string $dsn | ||
): array | ||
{ | ||
// see https://github.com/doctrine/dbal/pull/5843 | ||
|
||
$options = $this->create()->parse($dsn); | ||
|
||
$options = array_merge( | ||
$options, | ||
[ | ||
'charset' => 'utf8mb4', | ||
'defaultTableOptions' => [ | ||
'charset' => 'utf8mb4', | ||
'collation' => 'utf8mb4_unicode_ci', | ||
] | ||
] | ||
); | ||
|
||
return $options; | ||
} | ||
} |