@@ -134,10 +134,10 @@ discard block |
||
| 134 | 134 | $statement[] = 'CONSTRAINT'; |
| 135 | 135 | $statement[] = $driver->identifier($this->name); |
| 136 | 136 | $statement[] = 'FOREIGN KEY'; |
| 137 | - $statement[] = '(' . $driver->identifier($this->column) . ')'; |
|
| 137 | + $statement[] = '('.$driver->identifier($this->column).')'; |
|
| 138 | 138 | |
| 139 | - $statement[] = 'REFERENCES ' . $driver->identifier($this->foreignTable); |
|
| 140 | - $statement[] = '(' . $driver->identifier($this->foreignKey) . ')'; |
|
| 139 | + $statement[] = 'REFERENCES '.$driver->identifier($this->foreignTable); |
|
| 140 | + $statement[] = '('.$driver->identifier($this->foreignKey).')'; |
|
| 141 | 141 | |
| 142 | 142 | $statement[] = "ON DELETE {$this->deleteRule}"; |
| 143 | 143 | $statement[] = "ON UPDATE {$this->updateRule}"; |
@@ -160,7 +160,7 @@ discard block |
||
| 160 | 160 | */ |
| 161 | 161 | protected function generateName(): string |
| 162 | 162 | { |
| 163 | - $name = $this->table . '_foreign_' . $this->column . '_' . uniqid(); |
|
| 163 | + $name = $this->table.'_foreign_'.$this->column.'_'.uniqid(); |
|
| 164 | 164 | |
| 165 | 165 | if (strlen($name) > 64) { |
| 166 | 166 | //Many dbs has limitations on identifier length |
@@ -110,7 +110,7 @@ |
||
| 110 | 110 | protected function generateName(): string |
| 111 | 111 | { |
| 112 | 112 | //We can generate name |
| 113 | - $name = $this->table . '_index_' . implode('_', $this->columns) . '_' . uniqid(); |
|
| 113 | + $name = $this->table.'_index_'.implode('_', $this->columns).'_'.uniqid(); |
|
| 114 | 114 | |
| 115 | 115 | if (strlen($name) > 64) { |
| 116 | 116 | //Many dbs has limitations on identifier length |
@@ -21,10 +21,10 @@ |
||
| 21 | 21 | $statement = []; |
| 22 | 22 | |
| 23 | 23 | $statement[] = 'FOREIGN KEY'; |
| 24 | - $statement[] = '(' . $driver->identifier($this->column) . ')'; |
|
| 24 | + $statement[] = '('.$driver->identifier($this->column).')'; |
|
| 25 | 25 | |
| 26 | - $statement[] = 'REFERENCES ' . $driver->identifier($this->foreignTable); |
|
| 27 | - $statement[] = '(' . $driver->identifier($this->foreignKey) . ')'; |
|
| 26 | + $statement[] = 'REFERENCES '.$driver->identifier($this->foreignTable); |
|
| 27 | + $statement[] = '('.$driver->identifier($this->foreignKey).')'; |
|
| 28 | 28 | |
| 29 | 29 | $statement[] = "ON DELETE {$this->deleteRule}"; |
| 30 | 30 | $statement[] = "ON UPDATE {$this->updateRule}"; |
@@ -92,14 +92,14 @@ discard block |
||
| 92 | 92 | public function getPrimary(string $prefix, string $table): string |
| 93 | 93 | { |
| 94 | 94 | if (!empty($this->cacheStore) && empty($this->primaryKeys)) { |
| 95 | - $this->primaryKeys = (array)$this->cacheStore->get($this->getSource() . '/keys'); |
|
| 95 | + $this->primaryKeys = (array)$this->cacheStore->get($this->getSource().'/keys'); |
|
| 96 | 96 | } |
| 97 | 97 | |
| 98 | 98 | if (!empty($this->primaryKeys) && array_key_exists($table, $this->primaryKeys)) { |
| 99 | 99 | return $this->primaryKeys[$table]; |
| 100 | 100 | } |
| 101 | 101 | |
| 102 | - if (!$this->hasTable($prefix . $table)) { |
|
| 102 | + if (!$this->hasTable($prefix.$table)) { |
|
| 103 | 103 | throw new DriverException( |
| 104 | 104 | "Unable to fetch table primary key, no such table '{$prefix}{$table}' exists" |
| 105 | 105 | ); |
@@ -115,7 +115,7 @@ discard block |
||
| 115 | 115 | |
| 116 | 116 | //Caching |
| 117 | 117 | if (!empty($this->memory)) { |
| 118 | - $this->cacheStore->forever($this->getSource() . '/keys', $this->primaryKeys); |
|
| 118 | + $this->cacheStore->forever($this->getSource().'/keys', $this->primaryKeys); |
|
| 119 | 119 | } |
| 120 | 120 | |
| 121 | 121 | return $this->primaryKeys[$table]; |
@@ -130,7 +130,7 @@ discard block |
||
| 130 | 130 | { |
| 131 | 131 | return $this->factory->make( |
| 132 | 132 | PostgresQuery::class, |
| 133 | - ['driver' => $this, 'compiler' => $this->queryCompiler($prefix),] + $parameters |
|
| 133 | + ['driver' => $this, 'compiler' => $this->queryCompiler($prefix), ] + $parameters |
|
| 134 | 134 | ); |
| 135 | 135 | } |
| 136 | 136 | |
@@ -28,24 +28,24 @@ |
||
| 28 | 28 | $schema = $driver->tableSchema('accounts'); |
| 29 | 29 | |
| 30 | 30 | foreach ($schema->getColumns() as $column) { |
| 31 | - print_R($column->getName() . " "); |
|
| 32 | - print_R($column->abstractType() . "\n "); |
|
| 31 | + print_R($column->getName()." "); |
|
| 32 | + print_R($column->abstractType()."\n "); |
|
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | echo "----------\n"; |
| 36 | 36 | foreach ($schema->getIndexes() as $index) { |
| 37 | 37 | print_r($index->getName()); |
| 38 | - print_r($index->getColumns() ); |
|
| 38 | + print_r($index->getColumns()); |
|
| 39 | 39 | print_r("\n"); |
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | echo "----------\n"; |
| 43 | 43 | |
| 44 | 44 | foreach ($schema->getForeigns() as $f) { |
| 45 | - print_r($f->getName() . ' '); |
|
| 46 | - print_r($f->getColumn() . ' '); |
|
| 47 | - print_r($f->getForeignTable() . ' '); |
|
| 48 | - print_r($f->getForeignKey() . "\n"); |
|
| 45 | + print_r($f->getName().' '); |
|
| 46 | + print_r($f->getColumn().' '); |
|
| 47 | + print_r($f->getForeignTable().' '); |
|
| 48 | + print_r($f->getForeignKey()."\n"); |
|
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | print_r($schema->getPrimaryKeys()); |