CreateUsersTable   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A down() 0 3 1
A up() 0 13 1
1
<?php
2
3
use Illuminate\Database\Migrations\Migration;
4
use Illuminate\Database\Schema\Blueprint;
5
use Illuminate\Support\Facades\Schema;
6
7
class CreateUsersTable extends Migration
8
{
9
    /**
10
     * Run the migrations.
11
     */
12
    public function up()
13
    {
14
        Schema::create('users', function (Blueprint $table) {
15
            //primary
16
            $table->unsignedInteger('user_id');
17
            $table->unsignedInteger('organization_id');
18
            $table->primary(['user_id', 'organization_id']);
19
            //related user
20
            $table->unsignedInteger('referred_by_user_id')->nullable();
21
            $table->unsignedInteger('referred_by_organization_id')->nullable();
22
            $table->string('name')->unique();
23
            $table->unsignedInteger('counter')->default(0);
24
            $table->timestamps();
25
        });
26
    }
27
28
    /**
29
     * Reverse the migrations.
30
     */
31
    public function down()
32
    {
33
        Schema::drop('users');
34
    }
35
}
36