CreateMessagingTables   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 73
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0
Metric Value
wmc 2
lcom 0
cbo 0
dl 0
loc 73
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A up() 0 48 1
A down() 0 9 1
1
<?php
2
3
use jlourenco\base\Database\Blueprint;
4
use Illuminate\Database\Migrations\Migration;
5
6
class CreateMessagingTables 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
9
    /**
10
     * Run the migrations.
11
     *
12
     * @return void
13
     */
14
    public function up()
15
    {
16
17
        Schema::create('WarningType', function (Blueprint $table) {
18
            $table->increments('id');
19
            $table->string('name', 100);
20
            $table->string('color', 6);
21
            $table->timestamps();
22
            $table->softDeletes();
23
        });
24
25
        Schema::create('Warning', function (Blueprint $table) {
26
            $table->increments('id');
27
            $table->integer('warningtype')->unsigned();
28
            $table->text('message');
29
            $table->string('permissions', 250)->nullable();
30
            $table->timestamp('release_date')->nullable();
31
            $table->timestamp('remove_date')->nullable();
32
            $table->string('position', 20);
33
            $table->timestamps();
34
            $table->softDeletes();
35
36
            $table->foreign('warningtype')->references('id')->on('WarningType');
37
        });
38
39
        Schema::create('Message', function (Blueprint $table) {
40
            $table->increments('id');
41
            $table->integer('sent_by')->unsigned();
42
            $table->integer('parent')->unsigned();
43
            $table->text('body');
44
            $table->timestamps();
45
            $table->softDeletes();
46
47
            $table->foreign('sent_by')->references('id')->on('User');
48
            $table->foreign('parent')->references('id')->on('Message');
49
        });
50
51
        Schema::create('MessageLog', function (Blueprint $table) {
52
            $table->increments('id');
53
            $table->integer('message')->unsigned();
54
            $table->tinyinteger('status');
55
            $table->timestamps();
56
            $table->softDeletes();
57
58
            $table->foreign('message')->references('id')->on('Message');
59
        });
60
61
    }
62
63
    /**
64
     * Reverse the migrations.
65
     *
66
     * @return void
67
     */
68
    public function down()
69
    {
70
71
        Schema::drop('WarningType');
72
        Schema::drop('Warning');
73
        Schema::drop('MessageLog');
74
        Schema::drop('Message');
75
76
    }
77
78
}
79