AddTrackerLanguageForeignKeyToSessions   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 1
dl 0
loc 30
c 0
b 0
f 0
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A migrateUp() 0 10 1
A migrateDown() 0 6 1
1
<?php
2
3
use PragmaRX\Tracker\Support\Migration;
4
5
class AddTrackerLanguageForeignKeyToSessions extends Migration
6
{
7
    /**
8
     * Run the migrations.
9
     *
10
     * @return void
11
     */
12
    public function migrateUp()
13
    {
14
        $this->builder->table('tracker_sessions', function ($table) {
15
            $table->foreign('language_id')
16
                    ->references('id')
17
                    ->on('tracker_languages')
18
                    ->onUpdate('cascade')
19
                    ->onDelete('cascade');
20
        });
21
    }
22
23
    /**
24
     * Reverse the migrations.
25
     *
26
     * @return void
27
     */
28
    public function migrateDown()
29
    {
30
        $this->builder->table('tracker_sessions', function ($table) {
31
            $table->dropForeign(['language_id']);
32
        });
33
    }
34
}
35