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

@@ 353-364 (lines=12) @@
350
        }
351
352
        // set the primary key(s)
353
        if (isset($options['primary_key'])) {
354
            $sql = rtrim($sql);
355
            $sql .= ' PRIMARY KEY (';
356
            if (is_string($options['primary_key'])) { // handle primary_key => 'id'
357
                $sql .= $this->quoteColumnName($options['primary_key']);
358
            } elseif (is_array($options['primary_key'])) { // handle primary_key => array('tag_id', 'resource_id')
359
                $sql .= implode(',', array_map([$this, 'quoteColumnName'], $options['primary_key']));
360
            }
361
            $sql .= ')';
362
        } else {
363
            $sql = substr(rtrim($sql), 0, -1); // no primary keys
364
        }
365
366
        $sql = rtrim($sql) . ');';
367
        // execute the sql