AddReferralToUsersTable::down()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 7
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
/*
4
 * This file is part of questocat/laravel-referral package.
5
 *
6
 * (c) questocat <[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 AddReferralToUsersTable extends Migration
17
{
18
    /**
19
     * Run the migrations.
20
     */
21
    public function up()
22
    {
23
        Schema::table('users', function (Blueprint $table) {
24
            $table->string('referred_by')->nullable()->index();
25
            $table->string('affiliate_id')->unique();
26
        });
27
    }
28
29
    /**
30
     * Reverse the migrations.
31
     */
32
    public function down()
33
    {
34
        Schema::table('users', function (Blueprint $table) {
35
            $table->dropColumn('referred_by');
36
            $table->dropColumn('affiliate_id');
37
        });
38
    }
39
}
40