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

@@ 264-275 (lines=12) @@
261
        }
262
263
        // set the primary key(s)
264
        if (isset($options['primary_key'])) {
265
            $sql = rtrim($sql);
266
            $sql .= ' PRIMARY KEY (';
267
            if (is_string($options['primary_key'])) { // handle primary_key => 'id'
268
                $sql .= $this->quoteColumnName($options['primary_key']);
269
            } elseif (is_array($options['primary_key'])) { // handle primary_key => array('tag_id', 'resource_id')
270
                $sql .= implode(',', array_map([$this, 'quoteColumnName'], $options['primary_key']));
271
            }
272
            $sql .= ')';
273
        } else {
274
            $sql = substr(rtrim($sql), 0, -1); // no primary keys
275
        }
276
277
        $sql = rtrim($sql) . ');';
278
        // execute the sql