src/Phinx/Db/Adapter/MysqlAdapter.php 1 location
|
@@ 263-267 (lines=5) @@
|
| 260 |
|
if (isset($options['primary_key'])) { |
| 261 |
|
$sql = rtrim($sql); |
| 262 |
|
$sql .= ' PRIMARY KEY ('; |
| 263 |
|
if (is_string($options['primary_key'])) { // handle primary_key => 'id' |
| 264 |
|
$sql .= $this->quoteColumnName($options['primary_key']); |
| 265 |
|
} elseif (is_array($options['primary_key'])) { // handle primary_key => array('tag_id', 'resource_id') |
| 266 |
|
$sql .= implode(',', array_map([$this, 'quoteColumnName'], $options['primary_key'])); |
| 267 |
|
} |
| 268 |
|
$sql .= ')'; |
| 269 |
|
} else { |
| 270 |
|
$sql = substr(rtrim($sql), 0, -1); // no primary keys |
src/Phinx/Db/Adapter/SQLiteAdapter.php 1 location
|
@@ 196-200 (lines=5) @@
|
| 193 |
|
if (isset($options['primary_key'])) { |
| 194 |
|
$sql = rtrim($sql); |
| 195 |
|
$sql .= ' PRIMARY KEY ('; |
| 196 |
|
if (is_string($options['primary_key'])) { // handle primary_key => 'id' |
| 197 |
|
$sql .= $this->quoteColumnName($options['primary_key']); |
| 198 |
|
} elseif (is_array($options['primary_key'])) { // handle primary_key => array('tag_id', 'resource_id') |
| 199 |
|
$sql .= implode(',', array_map([$this, 'quoteColumnName'], $options['primary_key'])); |
| 200 |
|
} |
| 201 |
|
$sql .= ')'; |
| 202 |
|
} else { |
| 203 |
|
$sql = substr(rtrim($sql), 0, -1); // no primary keys |
src/Phinx/Db/Adapter/SqlServerAdapter.php 1 location
|
@@ 247-251 (lines=5) @@
|
| 244 |
|
// set the primary key(s) |
| 245 |
|
if (isset($options['primary_key'])) { |
| 246 |
|
$pkSql = sprintf('CONSTRAINT PK_%s PRIMARY KEY (', $table->getName()); |
| 247 |
|
if (is_string($options['primary_key'])) { // handle primary_key => 'id' |
| 248 |
|
$pkSql .= $this->quoteColumnName($options['primary_key']); |
| 249 |
|
} elseif (is_array($options['primary_key'])) { // handle primary_key => array('tag_id', 'resource_id') |
| 250 |
|
$pkSql .= implode(',', array_map([$this, 'quoteColumnName'], $options['primary_key'])); |
| 251 |
|
} |
| 252 |
|
$pkSql .= ')'; |
| 253 |
|
$sqlBuffer[] = $pkSql; |
| 254 |
|
} |
src/Phinx/Db/Adapter/PostgresAdapter.php 1 location
|
@@ 218-222 (lines=5) @@
|
| 215 |
|
if (isset($options['primary_key'])) { |
| 216 |
|
$sql = rtrim($sql); |
| 217 |
|
$sql .= sprintf(' CONSTRAINT %s PRIMARY KEY (', $this->quoteColumnName($parts['table'] . '_pkey')); |
| 218 |
|
if (is_string($options['primary_key'])) { // handle primary_key => 'id' |
| 219 |
|
$sql .= $this->quoteColumnName($options['primary_key']); |
| 220 |
|
} elseif (is_array($options['primary_key'])) { // handle primary_key => array('tag_id', 'resource_id') |
| 221 |
|
$sql .= implode(',', array_map([$this, 'quoteColumnName'], $options['primary_key'])); |
| 222 |
|
} |
| 223 |
|
$sql .= ')'; |
| 224 |
|
} else { |
| 225 |
|
$sql = substr(rtrim($sql), 0, -1); // no primary keys |