Test Failed
Push — master ( d9783c...375e5d )
by Julien
05:59
created

AlterLtUsersTable::down()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
use Illuminate\Database\Migrations\Migration;
4
use Illuminate\Database\Schema\Blueprint;
5
use Illuminate\Support\Facades\Config;
6
use Illuminate\Support\Facades\Schema;
7
8
class AlterLtUsersTable extends Migration
9
{
10
    /**
11
     * Run the migrations.
12
     *
13
     * @return void
14
     */
15
    public function up()
16
    {
17
        Schema::table(config('user.table'), function (Blueprint $table) {
18
            if (!Schema::hasColumn('name')) {
19
                $table->string('name')->default('name');
20
            }
21
            if (!Schema::hasColumn('firstname')) {
22
                $table->string('firstname')->default('firstname');
23
            }
24
            if (!Schema::hasColumn('lastname')) {
25
                $table->string('lastname')->default('lastname');
26
            }
27
            if (!Schema::hasColumn('email')) {
28
                $table->string('email')->unique();
29
            }
30
31
            if (!Schema::hasColumn('password')) {
32
                $table->string('password', 60);
33
            }
34
        });
35
36
    }
37
38
    /**
39
     * Reverse the migrations.
40
     *
41
     * @return void
42
     */
43
    public function down()
44
    {
45
        Schema::dropIfExists('users');
46
    }
47
}
48