CreateLinksTable   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 4
dl 0
loc 31
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
use Illuminate\Database\Migrations\Migration;
6
use Illuminate\Database\Schema\Blueprint;
7
use Illuminate\Support\Facades\Schema;
8
9
class CreateLinksTable extends Migration
10
{
11
    /**
12
     * Run the migrations.
13
     *
14
     * @return void
15
     */
16
    public function up()
17
    {
18
        Schema::create(config('shortener.table'), function (Blueprint $table) {
19
            $table->increments('id');
20
            $table->string('original_url')->unique();
21
            $table->string('code')->nullable()->unique();
22
            $table->integer('requested_count')->default(0);
23
            $table->integer('used_count')->default(0);
24
            $table->timestamp('last_requested')->nullable();
25
            $table->timestamp('last_used')->nullable();
26
            $table->timestamps();
27
        });
28
    }
29
30
    /**
31
     * Reverse the migrations.
32
     *
33
     * @return void
34
     */
35
    public function down()
36
    {
37
        Schema::dropIfExists(config('shortener.table'));
38
    }
39
}
40