Passed
Push — master ( a03505...e50757 )
by Paul
04:17
created

CreateClicksTable   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 18
c 1
b 0
f 0
dl 0
loc 36
rs 10
wmc 2
1
<?php
2
3
use Illuminate\Database\Migrations\Migration;
4
use Illuminate\Database\Schema\Blueprint;
5
use Illuminate\Support\Facades\Schema;
6
7
class CreateClicksTable extends Migration
8
{
9
    /**
10
     * Run the migrations.
11
     *
12
     * @return void
13
     */
14
    public function up()
15
    {
16
        Schema::create('clicks', function (Blueprint $table) {
17
            $table->id();
18
            $table->bigInteger('url_id')->unsigned();
19
            $table->foreign('url_id')->references('id')->on('urls')->onDelete('cascade');
20
            $table->string('country')->nullable();
21
            $table->string('region')->nullable();
22
            $table->string('city')->nullable();
23
            $table->string('device_type')->nullable();
24
            $table->string('device_brand')->nullable();
25
            $table->string('device_model')->nullable();
26
            $table->string('os')->nullable();
27
            $table->string('browser')->nullable();
28
            $table->text('referer')->nullable();
29
            $table->string('referer_host')->nullable();
30
            $table->text('user_agent')->nullable();
31
            $table->dateTime('created_at');
32
        });
33
    }
34
35
    /**
36
     * Reverse the migrations.
37
     *
38
     * @return void
39
     */
40
    public function down()
41
    {
42
        Schema::dropIfExists('clicks');
43
    }
44
}
45