-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
/
Copy pathPostgreSQLPlatform.php
796 lines (674 loc) · 23.9 KB
/
PostgreSQLPlatform.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
<?php
declare(strict_types=1);
namespace Doctrine\DBAL\Platforms;
use Doctrine\DBAL\Connection;
use Doctrine\DBAL\Platforms\Keywords\KeywordList;
use Doctrine\DBAL\Platforms\Keywords\PostgreSQLKeywords;
use Doctrine\DBAL\Schema\ForeignKeyConstraint;
use Doctrine\DBAL\Schema\Identifier;
use Doctrine\DBAL\Schema\Index;
use Doctrine\DBAL\Schema\PostgreSQLSchemaManager;
use Doctrine\DBAL\Schema\Sequence;
use Doctrine\DBAL\Schema\TableDiff;
use Doctrine\DBAL\TransactionIsolationLevel;
use Doctrine\DBAL\Types\Types;
use UnexpectedValueException;
use function array_merge;
use function array_unique;
use function array_values;
use function explode;
use function implode;
use function in_array;
use function is_array;
use function is_bool;
use function is_numeric;
use function is_string;
use function sprintf;
use function str_contains;
use function str_ends_with;
use function strtolower;
use function substr;
use function trim;
/**
* Provides the behavior, features and SQL dialect of the PostgreSQL database platform
* of the oldest supported version.
*/
class PostgreSQLPlatform extends AbstractPlatform
{
private bool $useBooleanTrueFalseStrings = true;
/** @var string[][] PostgreSQL booleans literals */
private array $booleanLiterals = [
'true' => [
't',
'true',
'y',
'yes',
'on',
'1',
],
'false' => [
'f',
'false',
'n',
'no',
'off',
'0',
],
];
/**
* PostgreSQL has different behavior with some drivers
* with regard to how booleans have to be handled.
*
* Enables use of 'true'/'false' or otherwise 1 and 0 instead.
*/
public function setUseBooleanTrueFalseStrings(bool $flag): void
{
$this->useBooleanTrueFalseStrings = $flag;
}
public function getRegexpExpression(): string
{
return 'SIMILAR TO';
}
public function getLocateExpression(string $string, string $substring, ?string $start = null): string
{
if ($start !== null) {
$string = $this->getSubstringExpression($string, $start);
return 'CASE WHEN (POSITION(' . $substring . ' IN ' . $string . ') = 0) THEN 0'
. ' ELSE (POSITION(' . $substring . ' IN ' . $string . ') + ' . $start . ' - 1) END';
}
return sprintf('POSITION(%s IN %s)', $substring, $string);
}
protected function getDateArithmeticIntervalExpression(
string $date,
string $operator,
string $interval,
DateIntervalUnit $unit,
): string {
if ($unit === DateIntervalUnit::QUARTER) {
$interval = $this->multiplyInterval($interval, 3);
$unit = DateIntervalUnit::MONTH;
}
return '(' . $date . ' ' . $operator . ' (' . $interval . " || ' " . $unit->value . "')::interval)";
}
public function getDateDiffExpression(string $date1, string $date2): string
{
return '(DATE(' . $date1 . ')-DATE(' . $date2 . '))';
}
public function getCurrentDatabaseExpression(): string
{
return 'CURRENT_DATABASE()';
}
public function supportsSequences(): bool
{
return true;
}
public function supportsSchemas(): bool
{
return true;
}
public function supportsIdentityColumns(): bool
{
return true;
}
/** @internal The method should be only used from within the {@see AbstractPlatform} class hierarchy. */
public function supportsPartialIndexes(): bool
{
return true;
}
/** @internal The method should be only used from within the {@see AbstractPlatform} class hierarchy. */
public function supportsCommentOnStatement(): bool
{
return true;
}
/** @internal The method should be only used from within the {@see AbstractSchemaManager} class hierarchy. */
public function getListDatabasesSQL(): string
{
return 'SELECT datname FROM pg_database';
}
/** @internal The method should be only used from within the {@see AbstractSchemaManager} class hierarchy. */
public function getListSequencesSQL(string $database): string
{
return 'SELECT sequence_name AS relname,
sequence_schema AS schemaname,
minimum_value AS min_value,
increment AS increment_by
FROM information_schema.sequences
WHERE sequence_catalog = ' . $this->quoteStringLiteral($database) . "
AND sequence_schema NOT LIKE 'pg\_%'
AND sequence_schema != 'information_schema'";
}
/** @internal The method should be only used from within the {@see AbstractSchemaManager} class hierarchy. */
public function getListViewsSQL(string $database): string
{
return 'SELECT quote_ident(table_name) AS viewname,
table_schema AS schemaname,
view_definition AS definition
FROM information_schema.views
WHERE view_definition IS NOT NULL';
}
/** @internal The method should be only used from within the {@see AbstractPlatform} class hierarchy. */
public function getAdvancedForeignKeyOptionsSQL(ForeignKeyConstraint $foreignKey): string
{
$query = '';
if ($foreignKey->hasOption('match')) {
$query .= ' MATCH ' . $foreignKey->getOption('match');
}
$query .= parent::getAdvancedForeignKeyOptionsSQL($foreignKey);
if ($foreignKey->hasOption('deferrable') && $foreignKey->getOption('deferrable') !== false) {
$query .= ' DEFERRABLE';
} else {
$query .= ' NOT DEFERRABLE';
}
if (
$foreignKey->hasOption('deferred') && $foreignKey->getOption('deferred') !== false
) {
$query .= ' INITIALLY DEFERRED';
} else {
$query .= ' INITIALLY IMMEDIATE';
}
return $query;
}
/**
* {@inheritDoc}
*/
public function getAlterTableSQL(TableDiff $diff): array
{
$sql = [];
$commentsSQL = [];
$table = $diff->getOldTable();
$tableNameSQL = $table->getQuotedName($this);
foreach ($diff->getAddedColumns() as $addedColumn) {
$query = 'ADD ' . $this->getColumnDeclarationSQL(
$addedColumn->getQuotedName($this),
$addedColumn->toArray(),
);
$sql[] = 'ALTER TABLE ' . $tableNameSQL . ' ' . $query;
$comment = $addedColumn->getComment();
if ($comment === '') {
continue;
}
$commentsSQL[] = $this->getCommentOnColumnSQL(
$tableNameSQL,
$addedColumn->getQuotedName($this),
$comment,
);
}
foreach ($diff->getDroppedColumns() as $droppedColumn) {
$query = 'DROP ' . $droppedColumn->getQuotedName($this);
$sql[] = 'ALTER TABLE ' . $tableNameSQL . ' ' . $query;
}
foreach ($diff->getChangedColumns() as $columnDiff) {
$oldColumn = $columnDiff->getOldColumn();
$newColumn = $columnDiff->getNewColumn();
$oldColumnName = $oldColumn->getQuotedName($this);
$newColumnName = $newColumn->getQuotedName($this);
if ($columnDiff->hasNameChanged()) {
$sql = array_merge(
$sql,
$this->getRenameColumnSQL($tableNameSQL, $oldColumnName, $newColumnName),
);
}
if (
$columnDiff->hasTypeChanged()
|| $columnDiff->hasPrecisionChanged()
|| $columnDiff->hasScaleChanged()
|| $columnDiff->hasFixedChanged()
|| $columnDiff->hasLengthChanged()
|| $columnDiff->hasPlatformOptionsChanged()
) {
$type = $newColumn->getType();
// SERIAL/BIGSERIAL are not "real" types and we can't alter a column to that type
$columnDefinition = $newColumn->toArray();
$columnDefinition['autoincrement'] = false;
// here was a server version check before, but DBAL API does not support this anymore.
$query = 'ALTER ' . $newColumnName . ' TYPE ' . $type->getSQLDeclaration($columnDefinition, $this);
$sql[] = 'ALTER TABLE ' . $tableNameSQL . ' ' . $query;
}
if ($columnDiff->hasDefaultChanged()) {
$defaultClause = $newColumn->getDefault() === null
? ' DROP DEFAULT'
: ' SET' . $this->getDefaultValueDeclarationSQL($newColumn->toArray());
$query = 'ALTER ' . $newColumnName . $defaultClause;
$sql[] = 'ALTER TABLE ' . $tableNameSQL . ' ' . $query;
}
if ($columnDiff->hasNotNullChanged()) {
$query = 'ALTER ' . $newColumnName . ' ' . ($newColumn->getNotnull() ? 'SET' : 'DROP') . ' NOT NULL';
$sql[] = 'ALTER TABLE ' . $tableNameSQL . ' ' . $query;
}
if ($columnDiff->hasAutoIncrementChanged()) {
if ($newColumn->getAutoincrement()) {
$query = 'ADD GENERATED BY DEFAULT AS IDENTITY';
} else {
$query = 'DROP IDENTITY';
}
$sql[] = 'ALTER TABLE ' . $tableNameSQL . ' ALTER ' . $newColumnName . ' ' . $query;
}
if (! $columnDiff->hasCommentChanged()) {
continue;
}
$commentsSQL[] = $this->getCommentOnColumnSQL(
$tableNameSQL,
$newColumn->getQuotedName($this),
$newColumn->getComment(),
);
}
return array_merge(
$this->getPreAlterTableIndexForeignKeySQL($diff),
$sql,
$commentsSQL,
$this->getPostAlterTableIndexForeignKeySQL($diff),
);
}
/**
* {@inheritDoc}
*/
protected function getRenameIndexSQL(string $oldIndexName, Index $index, string $tableName): array
{
if (str_contains($tableName, '.')) {
[$schema] = explode('.', $tableName);
$oldIndexName = $schema . '.' . $oldIndexName;
}
return ['ALTER INDEX ' . $oldIndexName . ' RENAME TO ' . $index->getQuotedName($this)];
}
public function getCreateSequenceSQL(Sequence $sequence): string
{
return 'CREATE SEQUENCE ' . $sequence->getQuotedName($this) .
' INCREMENT BY ' . $sequence->getAllocationSize() .
' MINVALUE ' . $sequence->getInitialValue() .
' START ' . $sequence->getInitialValue() .
$this->getSequenceCacheSQL($sequence);
}
public function getAlterSequenceSQL(Sequence $sequence): string
{
return 'ALTER SEQUENCE ' . $sequence->getQuotedName($this) .
' INCREMENT BY ' . $sequence->getAllocationSize() .
$this->getSequenceCacheSQL($sequence);
}
/**
* Cache definition for sequences
*/
private function getSequenceCacheSQL(Sequence $sequence): string
{
if ($sequence->getCache() > 1) {
return ' CACHE ' . $sequence->getCache();
}
return '';
}
public function getDropSequenceSQL(string $name): string
{
return parent::getDropSequenceSQL($name) . ' CASCADE';
}
public function getDropForeignKeySQL(string $foreignKey, string $table): string
{
return $this->getDropConstraintSQL($foreignKey, $table);
}
public function getDropIndexSQL(string $name, string $table): string
{
if ($name === '"primary"') {
if (str_ends_with($table, '"')) {
$constraintName = substr($table, 0, -1) . '_pkey"';
} else {
$constraintName = $table . '_pkey';
}
return $this->getDropConstraintSQL($constraintName, $table);
}
return parent::getDropIndexSQL($name, $table);
}
/**
* {@inheritDoc}
*/
protected function _getCreateTableSQL(string $name, array $columns, array $options = []): array
{
$queryFields = $this->getColumnDeclarationListSQL($columns);
if (isset($options['primary']) && ! empty($options['primary'])) {
$keyColumns = array_unique(array_values($options['primary']));
$queryFields .= ', PRIMARY KEY(' . implode(', ', $keyColumns) . ')';
}
$unlogged = isset($options['unlogged']) && $options['unlogged'] === true ? ' UNLOGGED' : '';
$query = 'CREATE' . $unlogged . ' TABLE ' . $name . ' (' . $queryFields . ')';
$sql = [$query];
if (isset($options['indexes']) && ! empty($options['indexes'])) {
foreach ($options['indexes'] as $index) {
$sql[] = $this->getCreateIndexSQL($index, $name);
}
}
if (isset($options['uniqueConstraints'])) {
foreach ($options['uniqueConstraints'] as $uniqueConstraint) {
$sql[] = $this->getCreateUniqueConstraintSQL($uniqueConstraint, $name);
}
}
if (isset($options['foreignKeys'])) {
foreach ($options['foreignKeys'] as $definition) {
$sql[] = $this->getCreateForeignKeySQL($definition, $name);
}
}
return $sql;
}
/**
* Converts a single boolean value.
*
* First converts the value to its native PHP boolean type
* and passes it to the given callback function to be reconverted
* into any custom representation.
*
* @param mixed $value The value to convert.
* @param callable $callback The callback function to use for converting the real boolean value.
*
* @throws UnexpectedValueException
*/
private function convertSingleBooleanValue(mixed $value, callable $callback): mixed
{
if ($value === null) {
return $callback(null);
}
if (is_bool($value) || is_numeric($value)) {
return $callback((bool) $value);
}
if (! is_string($value)) {
return $callback(true);
}
/**
* Better safe than sorry: http://php.net/in_array#106319
*/
if (in_array(strtolower(trim($value)), $this->booleanLiterals['false'], true)) {
return $callback(false);
}
if (in_array(strtolower(trim($value)), $this->booleanLiterals['true'], true)) {
return $callback(true);
}
throw new UnexpectedValueException(sprintf(
'Unrecognized boolean literal, %s given.',
$value,
));
}
/**
* Converts one or multiple boolean values.
*
* First converts the value(s) to their native PHP boolean type
* and passes them to the given callback function to be reconverted
* into any custom representation.
*
* @param mixed $item The value(s) to convert.
* @param callable $callback The callback function to use for converting the real boolean value(s).
*/
private function doConvertBooleans(mixed $item, callable $callback): mixed
{
if (is_array($item)) {
foreach ($item as $key => $value) {
$item[$key] = $this->convertSingleBooleanValue($value, $callback);
}
return $item;
}
return $this->convertSingleBooleanValue($item, $callback);
}
/**
* {@inheritDoc}
*
* Postgres wants boolean values converted to the strings 'true'/'false'.
*/
public function convertBooleans(mixed $item): mixed
{
if (! $this->useBooleanTrueFalseStrings) {
return parent::convertBooleans($item);
}
return $this->doConvertBooleans(
$item,
/** @param mixed $value */
static function ($value): string {
if ($value === null) {
return 'NULL';
}
return $value === true ? 'true' : 'false';
},
);
}
public function convertBooleansToDatabaseValue(mixed $item): mixed
{
if (! $this->useBooleanTrueFalseStrings) {
return parent::convertBooleansToDatabaseValue($item);
}
return $this->doConvertBooleans(
$item,
/** @param mixed $value */
static function ($value): ?int {
return $value === null ? null : (int) $value;
},
);
}
/**
* @param T $item
*
* @return (T is null ? null : bool)
*
* @template T
*/
public function convertFromBoolean(mixed $item): ?bool
{
if (in_array($item, $this->booleanLiterals['false'], true)) {
return false;
}
return parent::convertFromBoolean($item);
}
public function getSequenceNextValSQL(string $sequence): string
{
return "SELECT NEXTVAL('" . $sequence . "')";
}
public function getSetTransactionIsolationSQL(TransactionIsolationLevel $level): string
{
return 'SET SESSION CHARACTERISTICS AS TRANSACTION ISOLATION LEVEL '
. $this->_getTransactionIsolationLevelSQL($level);
}
/**
* {@inheritDoc}
*/
public function getBooleanTypeDeclarationSQL(array $column): string
{
return 'BOOLEAN';
}
/**
* {@inheritDoc}
*/
public function getIntegerTypeDeclarationSQL(array $column): string
{
return 'INT' . $this->_getCommonIntegerTypeDeclarationSQL($column);
}
/**
* {@inheritDoc}
*/
public function getBigIntTypeDeclarationSQL(array $column): string
{
return 'BIGINT' . $this->_getCommonIntegerTypeDeclarationSQL($column);
}
/**
* {@inheritDoc}
*/
public function getSmallIntTypeDeclarationSQL(array $column): string
{
return 'SMALLINT' . $this->_getCommonIntegerTypeDeclarationSQL($column);
}
/**
* {@inheritDoc}
*/
public function getGuidTypeDeclarationSQL(array $column): string
{
return 'UUID';
}
/**
* {@inheritDoc}
*/
public function getDateTimeTypeDeclarationSQL(array $column): string
{
return 'TIMESTAMP(0) WITHOUT TIME ZONE';
}
/**
* {@inheritDoc}
*/
public function getDateTimeTzTypeDeclarationSQL(array $column): string
{
return 'TIMESTAMP(0) WITH TIME ZONE';
}
/**
* {@inheritDoc}
*/
public function getDateTypeDeclarationSQL(array $column): string
{
return 'DATE';
}
/**
* {@inheritDoc}
*/
public function getTimeTypeDeclarationSQL(array $column): string
{
return 'TIME(0) WITHOUT TIME ZONE';
}
/**
* {@inheritDoc}
*/
protected function _getCommonIntegerTypeDeclarationSQL(array $column): string
{
if (! empty($column['autoincrement'])) {
return ' GENERATED BY DEFAULT AS IDENTITY';
}
return '';
}
protected function getVarcharTypeDeclarationSQLSnippet(?int $length): string
{
$sql = 'VARCHAR';
if ($length !== null) {
$sql .= sprintf('(%d)', $length);
}
return $sql;
}
protected function getBinaryTypeDeclarationSQLSnippet(?int $length): string
{
return 'BYTEA';
}
protected function getVarbinaryTypeDeclarationSQLSnippet(?int $length): string
{
return 'BYTEA';
}
/**
* {@inheritDoc}
*/
public function getClobTypeDeclarationSQL(array $column): string
{
return 'TEXT';
}
public function getDateTimeTzFormatString(): string
{
return 'Y-m-d H:i:sO';
}
public function getEmptyIdentityInsertSQL(string $quotedTableName, string $quotedIdentifierColumnName): string
{
return 'INSERT INTO ' . $quotedTableName . ' (' . $quotedIdentifierColumnName . ') VALUES (DEFAULT)';
}
public function getTruncateTableSQL(string $tableName, bool $cascade = false): string
{
$tableIdentifier = new Identifier($tableName);
$sql = 'TRUNCATE ' . $tableIdentifier->getQuotedName($this);
if ($cascade) {
$sql .= ' CASCADE';
}
return $sql;
}
/**
* Get the snippet used to retrieve the default value for a given column
*/
public function getDefaultColumnValueSQLSnippet(): string
{
return <<<'SQL'
SELECT pg_get_expr(adbin, adrelid)
FROM pg_attrdef
WHERE c.oid = pg_attrdef.adrelid
AND pg_attrdef.adnum=a.attnum
SQL;
}
protected function initializeDoctrineTypeMappings(): void
{
$this->doctrineTypeMapping = [
'bigint' => Types::BIGINT,
'bigserial' => Types::BIGINT,
'bool' => Types::BOOLEAN,
'boolean' => Types::BOOLEAN,
'bpchar' => Types::STRING,
'bytea' => Types::BLOB,
'char' => Types::STRING,
'date' => Types::DATE_MUTABLE,
'datetime' => Types::DATETIME_MUTABLE,
'decimal' => Types::DECIMAL,
'double' => Types::FLOAT,
'double precision' => Types::FLOAT,
'float' => Types::FLOAT,
'float4' => Types::SMALLFLOAT,
'float8' => Types::FLOAT,
'inet' => Types::STRING,
'int' => Types::INTEGER,
'int2' => Types::SMALLINT,
'int4' => Types::INTEGER,
'int8' => Types::BIGINT,
'integer' => Types::INTEGER,
'interval' => Types::STRING,
'json' => Types::JSON,
'jsonb' => Types::JSON,
'money' => Types::DECIMAL,
'numeric' => Types::DECIMAL,
'serial' => Types::INTEGER,
'serial4' => Types::INTEGER,
'serial8' => Types::BIGINT,
'real' => Types::SMALLFLOAT,
'smallint' => Types::SMALLINT,
'text' => Types::TEXT,
'time' => Types::TIME_MUTABLE,
'timestamp' => Types::DATETIME_MUTABLE,
'timestamptz' => Types::DATETIMETZ_MUTABLE,
'timetz' => Types::TIME_MUTABLE,
'tsvector' => Types::TEXT,
'uuid' => Types::GUID,
'varchar' => Types::STRING,
'year' => Types::DATE_MUTABLE,
'_varchar' => Types::STRING,
];
}
protected function createReservedKeywordsList(): KeywordList
{
return new PostgreSQLKeywords();
}
/**
* {@inheritDoc}
*/
public function getBlobTypeDeclarationSQL(array $column): string
{
return 'BYTEA';
}
/**
* {@inheritDoc}
*
* @internal The method should be only used from within the {@see AbstractPlatform} class hierarchy.
*/
public function getDefaultValueDeclarationSQL(array $column): string
{
if (isset($column['autoincrement']) && $column['autoincrement'] === true) {
return '';
}
return parent::getDefaultValueDeclarationSQL($column);
}
/** @internal The method should be only used from within the {@see AbstractPlatform} class hierarchy. */
public function supportsColumnCollation(): bool
{
return true;
}
/**
* {@inheritDoc}
*/
public function getJsonTypeDeclarationSQL(array $column): string
{
if (! empty($column['jsonb'])) {
return 'JSONB';
}
return 'JSON';
}
public function createSchemaManager(Connection $connection): PostgreSQLSchemaManager
{
return new PostgreSQLSchemaManager($connection, $this);
}
}