CreateApiLogTable::up()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 14
Code Lines 11

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 11
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 14
rs 9.9
1
<?php
2
3
use Illuminate\Database\Migrations\Migration;
4
use Illuminate\Database\Schema\Blueprint;
5
use Illuminate\Support\Facades\Schema;
6
use Sarahman\HttpRequestApiLog\Helper;
7
8
class CreateApiLogTable extends Migration
9
{
10
    public function up()
11
    {
12
        $config = Helper::getConfig();
13
14
        Schema::connection($config['database_connection'])->create($config['table_name'], function (Blueprint $table) {
15
            $table->bigIncrements('id');
16
            $table->string('client', 50)->index();
17
            $table->string('method', 6);
18
            $table->string('endpoint', 2083)->index();
19
            $table->longText('params');
20
            $table->char('response_code', 3);
21
            $table->longText('response');
22
            $table->timestamps();
23
            $table->index('created_at');
24
        });
25
    }
26
27
    public function down()
28
    {
29
        $config = Helper::getConfig();
30
31
        Schema::connection($config['database_connection'])->dropIfExists($config['table_name']);
32
    }
33
}
34