Code Duplication    Length = 12-12 lines in 3 locations

src/Phinx/Db/Adapter/MysqlAdapter.php 1 location

@@ 279-290 (lines=12) @@
276
        }
277
278
        // set the primary key(s)
279
        if (isset($options['primary_key'])) {
280
            $sql = rtrim($sql);
281
            $sql .= ' PRIMARY KEY (';
282
            if (is_string($options['primary_key'])) { // handle primary_key => 'id'
283
                $sql .= $this->quoteColumnName($options['primary_key']);
284
            } elseif (is_array($options['primary_key'])) { // handle primary_key => array('tag_id', 'resource_id')
285
                $sql .= implode(',', array_map([$this, 'quoteColumnName'], $options['primary_key']));
286
            }
287
            $sql .= ')';
288
        } else {
289
            $sql = substr(rtrim($sql), 0, -1); // no primary keys
290
        }
291
292
        // set the indexes
293
        foreach ($indexes as $index) {

src/Phinx/Db/Adapter/SQLiteAdapter.php 1 location

@@ 387-398 (lines=12) @@
384
        }
385
386
        // set the primary key(s)
387
        if (isset($options['primary_key'])) {
388
            $sql = rtrim($sql);
389
            $sql .= ' PRIMARY KEY (';
390
            if (is_string($options['primary_key'])) { // handle primary_key => 'id'
391
                $sql .= $this->quoteColumnName($options['primary_key']);
392
            } elseif (is_array($options['primary_key'])) { // handle primary_key => array('tag_id', 'resource_id')
393
                $sql .= implode(',', array_map([$this, 'quoteColumnName'], $options['primary_key']));
394
            }
395
            $sql .= ')';
396
        } else {
397
            $sql = substr(rtrim($sql), 0, -1); // no primary keys
398
        }
399
400
        $sql = rtrim($sql) . ');';
401
        // execute the sql

src/Phinx/Db/Adapter/PostgresAdapter.php 1 location

@@ 231-242 (lines=12) @@
228
        }
229
230
         // set the primary key(s)
231
        if (isset($options['primary_key'])) {
232
            $sql = rtrim($sql);
233
            $sql .= sprintf(' CONSTRAINT %s PRIMARY KEY (', $this->quoteColumnName($parts['table'] . '_pkey'));
234
            if (is_string($options['primary_key'])) { // handle primary_key => 'id'
235
                $sql .= $this->quoteColumnName($options['primary_key']);
236
            } elseif (is_array($options['primary_key'])) { // handle primary_key => array('tag_id', 'resource_id')
237
                $sql .= implode(',', array_map([$this, 'quoteColumnName'], $options['primary_key']));
238
            }
239
            $sql .= ')';
240
        } else {
241
            $sql = rtrim($sql, ', '); // no primary keys
242
        }
243
244
        $sql .= ')';
245
        $queries[] = $sql;