CreateMeetingAttachmentsTable::down()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
c 0
b 0
f 0
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
use Illuminate\Database\Schema\Blueprint;
4
use Illuminate\Database\Migrations\Migration;
5
6
class CreateMeetingAttachmentsTable 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...
7
{
8
    public function up()
9
    {
10
        Schema::create('meeting_attachments', function (Blueprint $table) {
11
            $table->increments('id');
12
13
            $table->string('filename');
14
            $table->string('storage_filename');
15
16
            $table->float('size')->comment('kilobytes');
17
18
            $table->unsignedInteger('meeting_id')->nullable();
19
            $table->foreign('meeting_id')
20
                ->references('id')
21
                ->on('meetings')
22
                ->onDelete('set null') // so we can later see that the attachment is not used and delete the file
23
                ->onUpdate('cascade');
24
25
            $table->unsignedInteger('owner_id')->nullable();
26
            $table->foreign('owner_id')
27
                ->references('id')
28
                ->on('members')
29
                ->onDelete('set null')
30
                ->onUpdate('cascade');
31
32
            $table->timestamps();
33
        });
34
    }
35
36
    public function down()
37
    {
38
        Schema::drop('meeting_attachments');
39
    }
40
}
41