CreateLinksTable   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 13
dl 0
loc 27
rs 10
c 2
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A up() 0 13 1
A down() 0 3 1
1
<?php
2
3
use Illuminate\Support\Facades\Schema;
4
use Illuminate\Database\Schema\Blueprint;
5
use Illuminate\Database\Migrations\Migration;
6
7
class CreateLinksTable extends Migration
8
{
9
    /**
10
     * Run the migrations.
11
     */
12
    public function up()
13
    {
14
        $local_conf = config('shorturl.drivers.local');
15
        Schema::create($local_conf['table_name'], function (Blueprint $table) use ($local_conf) {
16
            $table->charset = $local_conf['charset'] ?? "utf8";
17
            $table->collation = $local_conf['collation'] ?? "utf8_bin";
18
            $table->increments('id');
19
            $table->string('long_path', $local_conf['index_key_prefix_size'])->unique();
20
            $table->string('short_path', 10)->unique();
21
            $table->string('base_url')->nullable();
22
            $table->bigInteger('clicks')->nullable()->default(0);
23
            $table->text('properties')->nullable();
24
            $table->timestamps();
25
        });
26
    }
27
28
    /**
29
     * Reverse the migrations.
30
     */
31
    public function down()
32
    {
33
        Schema::dropIfExists(config('shorturl.drivers.local.table_name'));
34
    }
35
}
36
37