RemoveMibPollingTables   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 64
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 5
eloc 42
c 0
b 0
f 0
dl 0
loc 64
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A up() 0 5 1
A down() 0 45 4
1
<?php
2
3
use Illuminate\Database\Migrations\Migration;
4
use Illuminate\Database\Schema\Blueprint;
5
use Illuminate\Support\Facades\Schema;
6
7
class RemoveMibPollingTables extends Migration
8
{
9
    /**
10
     * Run the migrations.
11
     *
12
     * @return void
13
     */
14
    public function up()
15
    {
16
        Schema::drop('device_mibs');
17
        Schema::drop('device_oids');
18
        Schema::drop('mibdefs');
19
    }
20
21
    /**
22
     * Reverse the migrations.
23
     *
24
     * @return void
25
     */
26
    public function down()
27
    {
28
        Schema::create('device_mibs', function (Blueprint $table) {
29
            $table->unsignedInteger('device_id');
30
            $table->string('module');
31
            $table->string('mib');
32
            $table->string('included_by');
33
            if (\LibreNMS\DB\Eloquent::getDriver() == 'mysql') {
34
                $table->timestamp('last_modified')->default(DB::raw('CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP'));
35
            } else {
36
                $table->timestamp('last_modified')->useCurrent();
37
            }
38
            $table->primary(['device_id', 'module', 'mib']);
39
        });
40
        Schema::create('device_oids', function (Blueprint $table) {
41
            $table->unsignedInteger('device_id');
42
            $table->string('oid');
43
            $table->string('module');
44
            $table->string('mib');
45
            $table->string('object_type');
46
            $table->string('value')->nullable();
47
            $table->bigInteger('numvalue')->nullable();
48
            if (\LibreNMS\DB\Eloquent::getDriver() == 'mysql') {
49
                $table->timestamp('last_modified')->default(DB::raw('CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP'));
50
            } else {
51
                $table->timestamp('last_modified')->useCurrent();
52
            }
53
            $table->primary(['device_id', 'oid']);
54
        });
55
        Schema::create('mibdefs', function (Blueprint $table) {
56
            $table->string('module');
57
            $table->string('mib');
58
            $table->string('object_type');
59
            $table->string('oid');
60
            $table->string('syntax');
61
            $table->string('description')->nullable();
62
            $table->string('max_access')->nullable();
63
            $table->string('status')->nullable();
64
            $table->string('included_by');
65
            if (\LibreNMS\DB\Eloquent::getDriver() == 'mysql') {
66
                $table->timestamp('last_modified')->default(DB::raw('CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP'));
67
            } else {
68
                $table->timestamp('last_modified')->useCurrent();
69
            }
70
            $table->primary(['module', 'mib', 'object_type']);
71
        });
72
    }
73
}
74