Code Duplication    Length = 24-25 lines in 2 locations

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

@@ 1256-1280 (lines=25) @@
1253
     * @param \Phinx\Db\Table\ForeignKey $foreignKey
1254
     * @return string
1255
     */
1256
    protected function getForeignKeySqlDefinition(ForeignKey $foreignKey)
1257
    {
1258
        $def = '';
1259
        if ($foreignKey->getConstraint()) {
1260
            $def .= ' CONSTRAINT ' . $this->quoteColumnName($foreignKey->getConstraint());
1261
        } else {
1262
            $columnNames = [];
1263
            foreach ($foreignKey->getColumns() as $column) {
1264
                $columnNames[] = $this->quoteColumnName($column);
1265
            }
1266
            $def .= ' FOREIGN KEY (' . implode(',', $columnNames) . ')';
1267
            $refColumnNames = [];
1268
            foreach ($foreignKey->getReferencedColumns() as $column) {
1269
                $refColumnNames[] = $this->quoteColumnName($column);
1270
            }
1271
            $def .= ' REFERENCES ' . $this->quoteTableName($foreignKey->getReferencedTable()->getName()) . ' (' . implode(',', $refColumnNames) . ')';
1272
            if ($foreignKey->getOnDelete()) {
1273
                $def .= ' ON DELETE ' . $foreignKey->getOnDelete();
1274
            }
1275
            if ($foreignKey->getOnUpdate()) {
1276
                $def .= ' ON UPDATE ' . $foreignKey->getOnUpdate();
1277
            }
1278
        }
1279
1280
        return $def;
1281
    }
1282
1283
    /**

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

@@ 1237-1260 (lines=24) @@
1234
     * @param \Phinx\Db\Table\ForeignKey $foreignKey
1235
     * @return string
1236
     */
1237
    protected function getForeignKeySqlDefinition(ForeignKey $foreignKey)
1238
    {
1239
        $def = '';
1240
        if ($foreignKey->getConstraint()) {
1241
            $def .= ' CONSTRAINT ' . $this->quoteColumnName($foreignKey->getConstraint());
1242
        }
1243
        $columnNames = [];
1244
        foreach ($foreignKey->getColumns() as $column) {
1245
            $columnNames[] = $this->quoteColumnName($column);
1246
        }
1247
        $def .= ' FOREIGN KEY (' . implode(',', $columnNames) . ')';
1248
        $refColumnNames = [];
1249
        foreach ($foreignKey->getReferencedColumns() as $column) {
1250
            $refColumnNames[] = $this->quoteColumnName($column);
1251
        }
1252
        $def .= ' REFERENCES ' . $this->quoteTableName($foreignKey->getReferencedTable()->getName()) . ' (' . implode(',', $refColumnNames) . ')';
1253
        if ($foreignKey->getOnDelete()) {
1254
            $def .= ' ON DELETE ' . $foreignKey->getOnDelete();
1255
        }
1256
        if ($foreignKey->getOnUpdate()) {
1257
            $def .= ' ON UPDATE ' . $foreignKey->getOnUpdate();
1258
        }
1259
1260
        return $def;
1261
    }
1262
1263
    /**