Passed
Push — master ( 34de29...6cda2b )
by Carlos
01:35 queued 21s
created

CreateUserFollowerTable   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 8
c 0
b 0
f 0
dl 0
loc 22
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A up() 0 8 1
A down() 0 3 1
1
<?php
2
3
/*
4
 * This file is part of the overtrue/laravel-follow.
5
 *
6
 * (c) overtrue <[email protected]>
7
 *
8
 * This source file is subject to the MIT license that is bundled
9
 * with this source code in the file LICENSE.
10
 */
11
12
use Illuminate\Database\Migrations\Migration;
13
use Illuminate\Database\Schema\Blueprint;
14
use Illuminate\Support\Facades\Schema;
15
16
class CreateUserFollowerTable extends Migration
17
{
18
    /**
19
     * Run the migrations.
20
     */
21
    public function up()
22
    {
23
        Schema::create(config('follow.relation_table', 'user_follower'), function (Blueprint $table) {
24
            $table->increments('id');
25
            $table->unsignedBigInteger('following_id')->index();
26
            $table->unsignedBigInteger('follower_id')->index();
27
            $table->timestamp('accepted_at')->nullable()->index();
28
            $table->timestamps();
29
        });
30
    }
31
32
    /**
33
     * Reverse the migrations.
34
     */
35
    public function down()
36
    {
37
        Schema::dropIfExists(config('follow.followings_table', 'user_follower'));
38
    }
39
}
40