migrateDown()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 6
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
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