Code Duplication    Length = 24-25 lines in 2 locations

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

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

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

@@ 1190-1213 (lines=24) @@
1187
     * @param \Phinx\Db\Table\ForeignKey $foreignKey
1188
     * @return string
1189
     */
1190
    protected function getForeignKeySqlDefinition(ForeignKey $foreignKey)
1191
    {
1192
        $def = '';
1193
        if ($foreignKey->getConstraint()) {
1194
            $def .= ' CONSTRAINT ' . $this->quoteColumnName($foreignKey->getConstraint());
1195
        }
1196
        $columnNames = [];
1197
        foreach ($foreignKey->getColumns() as $column) {
1198
            $columnNames[] = $this->quoteColumnName($column);
1199
        }
1200
        $def .= ' FOREIGN KEY (' . implode(',', $columnNames) . ')';
1201
        $refColumnNames = [];
1202
        foreach ($foreignKey->getReferencedColumns() as $column) {
1203
            $refColumnNames[] = $this->quoteColumnName($column);
1204
        }
1205
        $def .= ' REFERENCES ' . $this->quoteTableName($foreignKey->getReferencedTable()->getName()) . ' (' . implode(',', $refColumnNames) . ')';
1206
        if ($foreignKey->getOnDelete()) {
1207
            $def .= ' ON DELETE ' . $foreignKey->getOnDelete();
1208
        }
1209
        if ($foreignKey->getOnUpdate()) {
1210
            $def .= ' ON UPDATE ' . $foreignKey->getOnUpdate();
1211
        }
1212
1213
        return $def;
1214
    }
1215
1216
    /**