|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
declare(strict_types=1); |
|
4
|
|
|
|
|
5
|
|
|
namespace Doctrine\DBAL\Platforms; |
|
6
|
|
|
|
|
7
|
|
|
use Doctrine\DBAL\Platforms\Keywords\PostgreSQL100Keywords; |
|
8
|
|
|
use Doctrine\DBAL\Schema\TableDiff; |
|
9
|
|
|
|
|
10
|
|
|
/** |
|
11
|
|
|
* Provides the behavior, features and SQL dialect of the PostgreSQL 10.0 database platform. |
|
12
|
|
|
*/ |
|
13
|
|
|
class PostgreSQL100Platform extends PostgreSQL94Platform |
|
14
|
|
|
{ |
|
15
|
|
|
/** |
|
16
|
|
|
* {@inheritdoc} |
|
17
|
977 |
|
*/ |
|
18
|
|
|
protected function getReservedKeywordsClass() : string |
|
19
|
977 |
|
{ |
|
20
|
|
|
return PostgreSQL100Keywords::class; |
|
21
|
|
|
} |
|
22
|
25 |
|
|
|
23
|
|
|
public function getListSequencesSQL($database) : string |
|
24
|
|
|
{ |
|
25
|
|
|
return "SELECT sequence_name AS relname, |
|
26
|
|
|
sequence_schema AS schemaname, |
|
27
|
|
|
minimum_value AS min_value, |
|
28
|
|
|
increment AS increment_by |
|
29
|
25 |
|
FROM information_schema.sequences |
|
30
|
|
|
WHERE sequence_catalog = " . $this->quoteStringLiteral($database) . " |
|
31
|
|
|
AND sequence_schema NOT LIKE 'pg\_%' |
|
32
|
|
|
AND sequence_schema != 'information_schema'"; |
|
33
|
|
|
} |
|
34
|
|
|
|
|
35
|
|
|
protected function getPreAlterTableIndexForeignKeySQL(TableDiff $diff) |
|
36
|
|
|
{ |
|
37
|
|
|
$tableName = $diff->getName($this)->getQuotedName($this); |
|
38
|
|
|
|
|
39
|
|
|
$sql = []; |
|
40
|
|
|
if ($this->supportsForeignKeyConstraints()) { |
|
41
|
|
|
foreach ($diff->removedForeignKeys as $foreignKey) { |
|
42
|
|
|
$sql[] = $this->getDropForeignKeySQL($foreignKey, $tableName); |
|
43
|
|
|
} |
|
44
|
|
|
foreach ($diff->changedForeignKeys as $foreignKey) { |
|
45
|
|
|
$sql[] = $this->getDropForeignKeySQL($foreignKey, $tableName); |
|
46
|
|
|
} |
|
47
|
|
|
} |
|
48
|
|
|
|
|
49
|
|
|
foreach ($diff->removedIndexes as $index) { |
|
50
|
|
|
$sql[] = $this->getDropIndexSQL($index, $tableName); |
|
51
|
|
|
} |
|
52
|
|
|
foreach ($diff->changedIndexes as $indexName => $index) { |
|
53
|
|
|
if ($index->isPrimary()) { |
|
54
|
|
|
$sql[] = $this->getDropConstraintSQL($indexName, $diff->fromTable); |
|
55
|
|
|
continue; |
|
56
|
|
|
} |
|
57
|
|
|
$sql[] = $this->getDropIndexSQL($index, $tableName); |
|
58
|
|
|
} |
|
59
|
|
|
|
|
60
|
|
|
return $sql; |
|
61
|
|
|
} |
|
62
|
|
|
} |
|
63
|
|
|
|