Skip to content

Commit f572a8f

Browse files
committed
Issue #430: PostgreSQL implementation
Signed-off-by: alexmerlin <[email protected]>
1 parent ad17c40 commit f572a8f

File tree

3 files changed

+19
-11
lines changed

3 files changed

+19
-11
lines changed

config/autoload/local.php.dist

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,24 @@ declare(strict_types=1);
55
$baseUrl = 'http://localhost:8080';
66

77
$databases = [
8-
'default' => [
8+
'mariadb' => [
99
'host' => 'localhost',
1010
'dbname' => 'dotkernel',
1111
'user' => '',
1212
'password' => '',
1313
'port' => 3306,
1414
'driver' => 'pdo_mysql',
15-
'charset' => 'utf8mb4',
16-
'collate' => 'utf8mb4_general_ci',
15+
'collation' => 'utf8mb4_general_ci',
16+
'table_prefix' => '',
17+
],
18+
'postgresql' => [
19+
'host' => 'localhost',
20+
'dbname' => 'dotkernel',
21+
'user' => '',
22+
'password' => '',
23+
'port' => 5432,
24+
'driver' => 'pdo_pgsql',
25+
'collation' => 'utf8mb4_general_ci',
1726
'table_prefix' => '',
1827
],
1928
// you can add more database connections to this array
@@ -51,7 +60,7 @@ return [
5160
'doctrine' => [
5261
'connection' => [
5362
'orm_default' => [
54-
'params' => $databases['default'],
63+
'params' => $databases['mariadb'],
5564
],
5665
],
5766
],

src/Core/src/App/src/DBAL/Types/AbstractEnumType.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ abstract class AbstractEnumType extends Type
1919
public function getSQLDeclaration(array $column, AbstractPlatform $platform): string
2020
{
2121
if ($platform instanceof PostgreSQLPlatform) {
22-
return static::NAME;
22+
return $this->getName();
2323
}
2424

2525
if ($platform instanceof SQLitePlatform) {
@@ -60,7 +60,7 @@ public function getEnumCases(): array
6060
}
6161

6262
/**
63-
* @return list<BackedEnum>
63+
* @return list<non-empty-string>
6464
*/
6565
public function getEnumValues(): array
6666
{

src/Core/src/App/src/Doctrine/MigrationsMigratedSubscriber.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
namespace Core\App\Doctrine;
66

7-
use BackedEnum;
87
use Core\App\DBAL\Types\AbstractEnumType;
98
use Doctrine\Common\EventSubscriber;
109
use Doctrine\DBAL\Connection;
@@ -124,10 +123,10 @@ private function getCustomEnumTypesFromTheDatabase(): array
124123
* @param list<non-empty-string> $dbEnumTypes
125124
* @param array<non-empty-string, AbstractEnumType> $fsEnumTypes
126125
* @return array{
127-
* create: array<non-empty-string, list<BackedEnum>>,
128-
* delete: array<non-empty-string, list<non-empty-string>>,
129-
* skip: array<non-empty-string, list<BackedEnum>>,
130-
* update: array<non-empty-string, list<BackedEnum>>
126+
* create: array<non-empty-string, list<non-empty-string>>,
127+
* delete: array<non-empty-string, list<non-empty-string>>,
128+
* skip: array<non-empty-string, list<non-empty-string>>,
129+
* update: array<non-empty-string, list<non-empty-string>>
131130
* }
132131
* @throws Exception
133132
*/

0 commit comments

Comments
 (0)