Code Duplication    Length = 12-12 lines in 3 locations

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

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

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

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

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

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