1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
namespace Yiisoft\Db\Oracle; |
6
|
|
|
|
7
|
|
|
use Yiisoft\Db\Exception\Exception; |
8
|
|
|
use Yiisoft\Db\Exception\NotSupportedException; |
9
|
|
|
use Yiisoft\Db\Query\DDLQueryBuilder as AbstractDDLQueryBuilder; |
10
|
|
|
use Yiisoft\Db\Query\QueryBuilderInterface; |
|
|
|
|
11
|
|
|
use Yiisoft\Db\Schema\ColumnSchemaBuilder; |
|
|
|
|
12
|
344 |
|
|
13
|
|
|
final class DDLQueryBuilder extends AbstractDDLQueryBuilder |
14
|
344 |
|
{ |
15
|
|
|
public function __construct(private QueryBuilderInterface $queryBuilder) |
16
|
|
|
{ |
17
|
2 |
|
parent::__construct($queryBuilder); |
18
|
|
|
} |
19
|
|
|
|
20
|
2 |
|
public function addForeignKey(string $name, string $table, array|string $columns, string $refTable, array|string $refColumns, ?string $delete = null, ?string $update = null): string |
21
|
|
|
{ |
22
|
2 |
|
$sql = 'ALTER TABLE ' . $this->quoter->quoteTableName($table) |
|
|
|
|
23
|
|
|
. ' ADD CONSTRAINT ' . $this->quoter->quoteColumnName($name) |
24
|
|
|
. ' FOREIGN KEY (' . $this->queryBuilder->buildColumns($columns) . ')' |
25
|
|
|
. ' REFERENCES ' . $this->quoter->quoteTableName($refTable) |
26
|
1 |
|
. ' (' . $this->queryBuilder->buildColumns($refColumns) . ')'; |
27
|
|
|
|
28
|
1 |
|
if ($delete !== null) { |
29
|
|
|
$sql .= ' ON DELETE ' . $delete; |
30
|
|
|
} |
31
|
|
|
|
32
|
|
|
if ($update !== null) { |
33
|
|
|
throw new Exception('Oracle does not support ON UPDATE clause.'); |
34
|
|
|
} |
35
|
|
|
|
36
|
|
|
return $sql; |
37
|
|
|
} |
38
|
|
|
|
39
|
|
|
public function alterColumn(string $table, string $column, ColumnSchemaBuilder|string $type): string |
40
|
|
|
{ |
41
|
|
|
return 'ALTER TABLE ' |
42
|
|
|
. $this->quoter->quoteTableName($table) |
|
|
|
|
43
|
|
|
. ' MODIFY ' |
44
|
|
|
. $this->quoter->quoteColumnName($column) |
45
|
|
|
. ' ' . $this->queryBuilder->getColumnType($type); |
46
|
|
|
} |
47
|
|
|
|
48
|
|
|
public function checkIntegrity(string $schema = '', string $table = '', bool $check = true): string |
49
|
|
|
{ |
50
|
|
|
throw new NotSupportedException('Oracle does not support enabling/disabling integrity check.'); |
51
|
|
|
} |
52
|
|
|
|
53
|
|
|
public function dropCommentFromColumn(string $table, string $column): string |
54
|
|
|
{ |
55
|
|
|
return 'COMMENT ON COLUMN ' |
56
|
|
|
. $this->quoter->quoteTableName($table) |
|
|
|
|
57
|
|
|
. '.' |
58
|
|
|
. $this->quoter->quoteColumnName($column) |
59
|
|
|
. " IS ''"; |
60
|
|
|
} |
61
|
|
|
|
62
|
|
|
public function dropCommentFromTable(string $table): string |
63
|
|
|
{ |
64
|
|
|
return 'COMMENT ON TABLE ' . $this->quoter->quoteTableName($table) . " IS ''"; |
|
|
|
|
65
|
|
|
} |
66
|
|
|
|
67
|
|
|
public function dropIndex(string $name, string $table): string |
68
|
|
|
{ |
69
|
|
|
return 'DROP INDEX ' . $this->quoter->quoteTableName($name); |
|
|
|
|
70
|
|
|
} |
71
|
|
|
|
72
|
|
|
public function renameTable(string $oldName, string $newName): string |
73
|
|
|
{ |
74
|
|
|
return 'ALTER TABLE ' . $this->quoter->quoteTableName($oldName) . ' RENAME TO ' . |
|
|
|
|
75
|
|
|
$this->quoter->quoteTableName($newName); |
76
|
|
|
} |
77
|
|
|
} |
78
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths