UptimeSetupTables   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 5

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 5
dl 0
loc 35
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A up() 0 21 1
A down() 0 5 1
1
<?php
2
3
use Illuminate\Database\Migrations\Migration;
4
use Illuminate\Database\Schema\Blueprint;
5
use Illuminate\Support\Facades\Schema;
6
7
class UptimeSetupTables extends Migration
8
{
9
    public function up()
10
    {
11
        Schema::create(config('uptime.endpoints_table'), function (Blueprint $table) {
12
            $table->increments('id')->unsigned();
13
            $table->text('uri');
14
            $table->integer('frequency');
15
            $table->timestamps();
16
        });
17
18
        Schema::create(config('uptime.statuses_table'), function (Blueprint $table) {
19
            $table->increments('id')->unsigned();
20
            $table->integer('endpoint_id')->unsigned();
21
            $table->integer('status_code');
22
            $table->timestamps();
23
24
            $table->foreign('endpoint_id')
25
                ->references('id')
26
                ->on(config('uptime.endpoints_table'))
27
                ->onDelete('cascade');
28
        });
29
    }
30
31
    /**
32
     * Reverse the migrations.
33
     *
34
     * @return void
35
     */
36
    public function down()
37
    {
38
        Schema::drop(config('uptime.endpoints_table'));
39
        Schema::drop(config('uptime.statuses_table'));
40
    }
41
}
42