Code Duplication    Length = 12-12 lines in 3 locations

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

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

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

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

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

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