Test Failed
Push — main ( 894963...0f30b5 )
by Rafael
05:41
created

anonymous//src/Modules/Admin/Migrations/00000000_0000_users.php$0   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 42
Duplicated Lines 0 %

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A 00000000_0000_users.php$0 ➔ down() 0 5 1
A 00000000_0000_users.php$0 ➔ up() 0 27 1
1
<?php
2
3
use Illuminate\Database\Capsule\Manager as Capsule;
4
use Illuminate\Database\Migrations\Migration;
5
use Illuminate\Database\Schema\Blueprint;
6
7
return new class extends Migration {
8
    /**
9
     * Run the migrations.
10
     */
11
    public function up(): void
12
    {
13
        Capsule::schema()->create('users', function (Blueprint $table) {
14
            $table->id();
15
            $table->string('name');
16
            $table->string('email')->unique();
17
            $table->timestamp('email_verified_at')->nullable();
18
            $table->string('password');
19
            $table->string('token')->nullable();
20
            $table->boolean('is_admin')->default(false);
21
            $table->rememberToken();
22
            $table->timestamps();
23
        });
24
25
        Capsule::schema()->create('password_reset_tokens', function (Blueprint $table) {
26
            $table->string('email')->primary();
27
            $table->string('token');
28
            $table->timestamp('created_at')->nullable();
29
        });
30
31
        Capsule::schema()->create('sessions', function (Blueprint $table) {
32
            $table->string('id')->primary();
33
            $table->foreignId('user_id')->nullable()->index();
34
            $table->string('ip_address', 45)->nullable();
35
            $table->text('user_agent')->nullable();
36
            $table->longText('payload');
37
            $table->integer('last_activity')->index();
38
        });
39
    }
40
41
    /**
42
     * Reverse the migrations.
43
     */
44
    public function down(): void
45
    {
46
        Capsule::schema()->dropIfExists('users');
47
        Capsule::schema()->dropIfExists('password_reset_tokens');
48
        Capsule::schema()->dropIfExists('sessions');
49
    }
50
};
51