Completed
Push — master ( 191581...1177bb )
by CodexShaper
03:27
created

CreateOauthClientsTable::up()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 18

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 18
rs 9.6666
c 0
b 0
f 0
cc 2
nc 2
nop 0
1
<?php
2
3
use CodexShaper\Database\Facades\Schema;
4
use Illuminate\Database\Migrations\Migration;
5
use Illuminate\Database\Schema\Blueprint;
6
7
class CreateOauthClientsTable extends Migration
8
{
9
    /**
10
     * Run the migrations.
11
     *
12
     * @return void
13
     */
14
    public function up()
15
    {
16
        if (!Schema::hasTable('oauth_clients')) {
17
            Schema::create('oauth_clients', function (Blueprint $table) {
18
                $table->increments('id');
19
                $table->bigInteger('user_id')->index()->nullable();
20
                $table->string('name');
21
                $table->string('secret', 100);
22
                $table->text('redirect')->default('http://localhost');
23
                $table->text('scopes')->default('[]');
24
                $table->boolean('personal_access_client')->default(0);
25
                $table->boolean('password_client')->default(0);
26
                $table->boolean('authorization_code_client')->default(0);
27
                $table->boolean('revoked')->default(false);
28
                $table->timestamps();
29
            });
30
        }
31
    }
32
33
    /**
34
     * Reverse the migrations.
35
     *
36
     * @return void
37
     */
38
    public function down()
39
    {
40
        if (Schema::hasTable('oauth_clients')) {
41
            Schema::dropIfExists('oauth_clients');
42
        }
43
    }
44
}
45