Passed
Push — master ( fde606...0af3c0 )
by Armando
08:21
created

AddForeignKeysToChosenInlineResultTable   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 16
Duplicated Lines 100 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 3
dl 16
loc 16
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A up() 0 4 1
A down() 0 4 1

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
<?php
2
3
declare(strict_types=1);
4
5
use Illuminate\Database\Migrations\Migration;
6
use Illuminate\Database\Schema\Blueprint;
7
use Illuminate\Support\Facades\Schema;
8
9
class AddForeignKeysToChosenInlineResultTable extends Migration
10
{
11
    public function up(): void
12
    {
13
        Schema::table('chosen_inline_result', static function (Blueprint $table) {
14
            $table->foreign('user_id', 'chosen_inline_result_ibfk_1')->references('id')->on('user')->onUpdate('RESTRICT')->onDelete('RESTRICT');
15
        });
16
    }
17
18
    public function down(): void
19
    {
20
        Schema::table('chosen_inline_result', static function (Blueprint $table) {
21
            $table->dropForeign('chosen_inline_result_ibfk_1');
22
        });
23
    }
24
}
25