Completed
Push — master ( e4d660...050514 )
by Abdelrahman
02:52 queued 01:47
created

...204408_create_plan_subscription_usage_table.php (2 issues)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
3
declare(strict_types=1);
4
5
use Illuminate\Database\Schema\Blueprint;
6
use Illuminate\Database\Migrations\Migration;
7
8
class CreatePlanSubscriptionUsageTable extends Migration
0 ignored issues
show
Coding Style Compatibility introduced by
PSR1 recommends that each class must be in a namespace of at least one level to avoid collisions.

You can fix this by adding a namespace to your class:

namespace YourVendor;

class YourClass { }

When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.

Loading history...
9
{
10
    /**
11
     * Run the migrations.
12
     *
13
     * @return void
14
     */
15
    public function up(): void
16
    {
17
        Schema::create(config('rinvex.subscriptions.tables.plan_subscription_usage'), function (Blueprint $table) {
18
            $table->increments('id');
19
            $table->integer('subscription_id')->unsigned();
20
            $table->integer('feature_id')->unsigned();
21
            $table->smallInteger('used')->unsigned();
22
            $table->dateTime('valid_until')->nullable();
23
            $table->string('timezone')->nullable();
24
            $table->timestamps();
25
            $table->softDeletes();
26
27
            $table->unique(['subscription_id', 'feature_id']);
28
            $table->foreign('subscription_id')->references('id')->on(config('rinvex.subscriptions.tables.plan_subscriptions'))
0 ignored issues
show
This line exceeds maximum limit of 120 characters; contains 126 characters

Overly long lines are hard to read on any screen. Most code styles therefor impose a maximum limit on the number of characters in a line.

Loading history...
29
                  ->onDelete('cascade')->onUpdate('cascade');
30
            $table->foreign('feature_id')->references('id')->on(config('rinvex.subscriptions.tables.plan_features'))
31
                  ->onDelete('cascade')->onUpdate('cascade');
32
        });
33
    }
34
35
    /**
36
     * Reverse the migrations.
37
     *
38
     * @return void
39
     */
40
    public function down(): void
41
    {
42
        Schema::dropIfExists(config('rinvex.subscriptions.tables.plan_subscription_usage'));
43
    }
44
}
45