Completed
Push — develop ( befadd...ff65be )
by Abdelrahman
01:13
created

CreatePlansTable::jsonable()   A

Complexity

Conditions 3
Paths 4

Size

Total Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 8
rs 10
c 0
b 0
f 0
cc 3
nc 4
nop 0
1
<?php
2
3
declare(strict_types=1);
4
5
use Illuminate\Database\Schema\Blueprint;
6
use Illuminate\Database\Migrations\Migration;
7
8
class CreatePlansTable extends Migration
9
{
10
    /**
11
     * Run the migrations.
12
     *
13
     * @return void
14
     */
15
    public function up(): void
16
    {
17
        Schema::create(config('rinvex.subscriptions.tables.plans'), function (Blueprint $table) {
18
            // Columns
19
            $table->increments('id');
20
            $table->string('slug');
21
            $table->json('name');
22
            $table->json('description')->nullable();
23
            $table->boolean('is_active')->default(true);
24
            $table->decimal('price')->default('0.00');
25
            $table->decimal('signup_fee')->default('0.00');
26
            $table->string('currency', 3);
27
            $table->smallInteger('trial_period')->unsigned()->default(0);
28
            $table->string('trial_interval')->default('day');
29
            $table->smallInteger('invoice_period')->unsigned()->default(0);
30
            $table->string('invoice_interval')->default('month');
31
            $table->smallInteger('grace_period')->unsigned()->default(0);
32
            $table->string('grace_interval')->default('day');
33
            $table->tinyInteger('prorate_day')->unsigned()->nullable();
34
            $table->tinyInteger('prorate_period')->unsigned()->nullable();
35
            $table->tinyInteger('prorate_extend_due')->unsigned()->nullable();
36
            $table->smallInteger('active_subscribers_limit')->unsigned()->nullable();
37
            $table->mediumInteger('sort_order')->unsigned()->default(0);
38
            $table->timestamps();
39
            $table->softDeletes();
40
41
            // Indexes
42
            $table->unique('slug');
43
        });
44
    }
45
46
    /**
47
     * Reverse the migrations.
48
     *
49
     * @return void
50
     */
51
    public function down(): void
52
    {
53
        Schema::dropIfExists(config('rinvex.subscriptions.tables.plans'));
54
    }
55
}
56