Code Duplication    Length = 12-12 lines in 3 locations

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

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

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/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