Completed
Push — master ( 423a77...7e6e45 )
by Christopher
13:19
created

CreateFriendsTable   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 3
Bugs 1 Features 0
Metric Value
wmc 2
c 3
b 1
f 0
lcom 0
cbo 2
dl 0
loc 35
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A up() 0 17 1
A down() 0 4 1
1
<?php
2
/**
3
 * This file is part of Friends.
4
 *
5
 * (c) Christopher Lass <[email protected]>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 */
10
use Illuminate\Database\Schema\Blueprint;
11
use Illuminate\Database\Migrations\Migration;
12
13
class CreateFriendsTable extends Migration
0 ignored issues
show
Coding Style Compatibility introduced by
PSR1 recommends that each class must be in a namespace of at least one level to avoid collisions.

You can fix this by adding a namespace to your class:

namespace YourVendor;

class YourClass { }

When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.

Loading history...
14
{
15
    /**
16
     * Run the migrations.
17
     *
18
     * @return void
19
     */
20
    public function up()
21
    {
22
        Schema::create('friends', function (Blueprint $table) {
23
            $table->unsignedInteger('sender_id')->index();
24
            $table->foreign('sender_id')
25
                ->references('id')
26
                ->on(\Config::get('friends.users_table'))
27
                ->onDelete('cascade');
28
            $table->unsignedInteger('recipient_id')->index();
29
            $table->foreign('recipient_id')
30
                ->references('id')
31
                ->on(\Config::get('friends.users_table'))
32
                ->onDelete('cascade');
33
            $table->tinyInteger('status')->default(0);
34
            $table->timestamps();
35
        });
36
    }
37
38
    /**
39
     * Reverse the migrations.
40
     *
41
     * @return void
42
     */
43
    public function down()
44
    {
45
        Schema::dropIfExists('friends');
46
    }
47
}
48