@@ -246,8 +246,7 @@ |
||
246 | 246 | $index = new IndexEntity(); |
247 | 247 | |
248 | 248 | $relname = $row["relname"]; |
249 | - $index->type = ($row["indispartial"] ? "INDEX" : |
|
250 | - ($row["indisprimary"] ? "PRIMARY" : ($row["indisunique"] ? "UNIQUE" : "INDEX"))); |
|
249 | + $index->type = ($row["indispartial"] ? "INDEX" : ($row["indisprimary"] ? "PRIMARY" : ($row["indisunique"] ? "UNIQUE" : "INDEX"))); |
|
251 | 250 | $index->columns = []; |
252 | 251 | foreach (explode(" ", $row["indkey"]) as $indkey) { |
253 | 252 | $index->columns[] = $columns[$indkey]; |
@@ -88,8 +88,7 @@ discard block |
||
88 | 88 | if ($val[0] != "INDEX") { |
89 | 89 | //! descending UNIQUE indexes results in syntax error |
90 | 90 | $create[] = ( |
91 | - $val[2] == "DROP" ? "\nDROP CONSTRAINT " . $this->driver->escapeId($val[1]) : |
|
92 | - "\nADD" . ($val[1] != "" ? " CONSTRAINT " . $this->driver->escapeId($val[1]) : "") . |
|
91 | + $val[2] == "DROP" ? "\nDROP CONSTRAINT " . $this->driver->escapeId($val[1]) : "\nADD" . ($val[1] != "" ? " CONSTRAINT " . $this->driver->escapeId($val[1]) : "") . |
|
93 | 92 | " $val[0] " . ($val[0] == "PRIMARY" ? "KEY " : "") . "(" . implode(", ", $val[2]) . ")" |
94 | 93 | ); |
95 | 94 | } elseif ($val[2] == "DROP") { |
@@ -202,7 +201,7 @@ discard block |
||
202 | 201 | */ |
203 | 202 | public function truncateTables(array $tables) |
204 | 203 | { |
205 | - $this->driver->execute("TRUNCATE " . implode(", ", array_map(function ($table) { |
|
204 | + $this->driver->execute("TRUNCATE " . implode(", ", array_map(function($table) { |
|
206 | 205 | return $this->driver->table($table); |
207 | 206 | }, $tables))); |
208 | 207 | return true; |
@@ -18,9 +18,7 @@ |
||
18 | 18 | */ |
19 | 19 | protected function limitToOne(string $table, string $query, string $where, string $separator = "\n") |
20 | 20 | { |
21 | - return (preg_match('~^INTO~', $query) ? $this->driver->limit($query, $where, 1, 0, $separator) : |
|
22 | - " $query" . ($this->driver->isView($this->driver->tableStatusOrName($table)) ? $where : |
|
23 | - " WHERE ctid = (SELECT ctid FROM " . $this->driver->table($table) . $where . $separator . "LIMIT 1)") |
|
21 | + return (preg_match('~^INTO~', $query) ? $this->driver->limit($query, $where, 1, 0, $separator) : " $query" . ($this->driver->isView($this->driver->tableStatusOrName($table)) ? $where : " WHERE ctid = (SELECT ctid FROM " . $this->driver->table($table) . $where . $separator . "LIMIT 1)") |
|
24 | 22 | ); |
25 | 23 | } |
26 | 24 |
@@ -114,13 +114,13 @@ |
||
114 | 114 | switch ($index->type) { |
115 | 115 | case 'UNIQUE': |
116 | 116 | $clauses[] = "CONSTRAINT " . $this->escapeId($index_name) . |
117 | - " UNIQUE (" . implode(', ', array_map(function ($column) { |
|
117 | + " UNIQUE (" . implode(', ', array_map(function($column) { |
|
118 | 118 | return $this->escapeId($column); |
119 | 119 | }, $index->columns)) . ")"; |
120 | 120 | break; |
121 | 121 | case 'PRIMARY': |
122 | 122 | $clauses[] = "CONSTRAINT " . $this->escapeId($index_name) . |
123 | - " PRIMARY KEY (" . implode(', ', array_map(function ($column) { |
|
123 | + " PRIMARY KEY (" . implode(', ', array_map(function($column) { |
|
124 | 124 | return $this->escapeId($column); |
125 | 125 | }, $index->columns)) . ")"; |
126 | 126 | break; |