Completed
Push — master ( caae32...da45f0 )
by ARCANEDEV
11s
created

CreateSettingsTable::up()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 11
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 7
nc 1
nop 0
dl 0
loc 11
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
use Arcanedev\Support\Database\Migration;
4
use Illuminate\Database\Schema\Blueprint;
5
6
/**
7
 * Class     CreateSettingsTable
8
 *
9
 * @author   ARCANEDEV <[email protected]>
10
 */
11
class CreateSettingsTable extends Migration
12
{
13
    /* -----------------------------------------------------------------
14
     |  Constructor
15
     | -----------------------------------------------------------------
16
     */
17
18
    /**
19
     * CreateSettingsTable constructor.
20
     */
21
    public function __construct()
22
    {
23
        $this->setConnection(config('settings.drivers.database.options.connection'));
24
        $this->setTable(config('settings.drivers.database.options.table', 'settings'));
25
    }
26
27
    /* -----------------------------------------------------------------
28
     |  Main Methods
29
     | -----------------------------------------------------------------
30
     */
31
32
    /**
33
     * {@inheritdoc}
34
     */
35
    public function up()
36
    {
37
        $this->createSchema(function(Blueprint $table) {
38
            $table->unsignedInteger('user_id')->default(0);
39
            $table->string('key');
40
            $table->text('value');
41
            $table->timestamps();
42
43
            $table->unique(['user_id', 'key']);
44
        });
45
    }
46
}
47