Code Duplication    Length = 12-12 lines in 3 locations

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

@@ 271-282 (lines=12) @@
268
        }
269
270
        // set the primary key(s)
271
        if (isset($options['primary_key'])) {
272
            $sql = rtrim($sql);
273
            $sql .= ' PRIMARY KEY (';
274
            if (is_string($options['primary_key'])) { // handle primary_key => 'id'
275
                $sql .= $this->quoteColumnName($options['primary_key']);
276
            } elseif (is_array($options['primary_key'])) { // handle primary_key => array('tag_id', 'resource_id')
277
                $sql .= implode(',', array_map([$this, 'quoteColumnName'], $options['primary_key']));
278
            }
279
            $sql .= ')';
280
        } else {
281
            $sql = substr(rtrim($sql), 0, -1); // no primary keys
282
        }
283
284
        // set the indexes
285
        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

@@ 211-222 (lines=12) @@
208
        }
209
210
        // set the primary key(s)
211
        if (isset($options['primary_key'])) {
212
            $sql = rtrim($sql);
213
            $sql .= ' PRIMARY KEY (';
214
            if (is_string($options['primary_key'])) { // handle primary_key => 'id'
215
                $sql .= $this->quoteColumnName($options['primary_key']);
216
            } elseif (is_array($options['primary_key'])) { // handle primary_key => array('tag_id', 'resource_id')
217
                $sql .= implode(',', array_map([$this, 'quoteColumnName'], $options['primary_key']));
218
            }
219
            $sql .= ')';
220
        } else {
221
            $sql = substr(rtrim($sql), 0, -1); // no primary keys
222
        }
223
224
        $sql = rtrim($sql) . ');';
225
        // execute the sql