Laravel migrations (#8868)

* Add migrations and seeds

* Fix spacing validation issues

* Fix linting

* Update tabs to spaces

* Update daily and install process

* Make build-base.php use the new migrations if empty or at dbschema 1000.
Seed 1000 into the database.
Temp fix for the route table index length (this table basically isn't used...)

* Fix typo in seed.
Hard code legacy schema checks to version 1000 (999 would have worked as is)

* Port association table no longer exists

* Make database validate again

* DB schema, remove as many DB::statement as possible

* update migrations
add librenms cli entry point (artisan)
update validate to check laravel migrations

* remove statements from users migration

* Fix up daily.sh and the 1000 migration

* Update migrations to current state
Take advantage of environment variables to set DB credentials.

* Fix style issues

* Update schema

* fix test db collation

* Fix migration table definition

* update db migrations

* Update migrations

* Update stats callback.  Just count the total migrations applied.

* Update 1000.sql.

* update migrations

* remove the graph type seeder, it is no longer needed

* update docs

* fix whitespace

* remove extra schema

* update tests

* fix sort

* add message

* dbSchema should actually be 1000

* add character set to db create

* Fix some artisan issues

* Update schema
This commit is contained in:
Paul Heinrichs 2019-01-14 07:44:23 -05:00 committed by Tony Murray
parent 29f8a8d4a3
commit ebe2ecf524
151 changed files with 6136 additions and 178 deletions

View File

@ -28,7 +28,7 @@ cache:
before_install:
- sudo apt-get -qq update
- sudo apt-get install -y snmp fping python3-pip
- mysql -e 'CREATE DATABASE librenms_phpunit_78hunjuybybh;'
- mysql -e 'CREATE DATABASE librenms_phpunit_78hunjuybybh CHARACTER SET utf8 COLLATE utf8_unicode_ci;'
- cp tests/config/config.test.php config.php
install:

View File

@ -522,12 +522,15 @@ class Config
// Check for testing database
if (getenv('DBTEST')) {
if (isset($config['test_db_name'])) {
putenv('DB_DATABASE=' . $config['test_db_name']);
$config['db_name'] = $config['test_db_name'];
}
if (isset($config['test_db_user'])) {
putenv('DB_USERNAME=' . $config['test_db_user']);
$config['db_user'] = $config['test_db_user'];
}
if (isset($config['test_db_pass'])) {
putenv('DB_PASSWORD=' . $config['test_db_pass']);
$config['db_pass'] = $config['test_db_pass'];
}
}

View File

@ -46,12 +46,15 @@ class Database extends BaseValidation
// check database schema version
$current = get_db_schema();
$latest = 1000;
$schemas = get_schema_list();
end($schemas);
$latest = key($schemas);
if ($current < $latest) {
if ($current === 0 || $current === $latest) {
\Artisan::call('migrate', ['--pretend' => true, '--force' => true]);
if (\Artisan::output() !== "Nothing to migrate.\n") {
$validator->fail("Your database is out of date!", './librenms migrate');
return;
}
} elseif ($current < $latest) {
$validator->fail(
"Your database schema ($current) is older than the latest ($latest).",
"Manually run ./daily.sh, and check for any errors."

View File

@ -25,26 +25,29 @@
*/
if (!isset($init_modules)) {
$init_modules = array('nodb');
require __DIR__ . '/includes/init.php';
$opts = getopt('ldh:u:p:n:t:s:');
if (isset($opts['h'])) {
dbConnect(
isset($opts['h']) ? $opts['h'] : null,
isset($opts['u']) ? $opts['u'] : '',
isset($opts['p']) ? $opts['p'] : '',
isset($opts['n']) ? $opts['n'] : '',
isset($opts['t']) ? $opts['t'] : null,
isset($opts['s']) ? $opts['s'] : null
);
} else {
// use configured database credentials
\LibreNMS\DB\Eloquent::boot();
$map = [
'h' => 'DB_HOST',
'u' => 'DB_USERNAME',
'p' => 'DB_PASSWORD',
'n' => 'DB_DATABASE',
't' => 'DB_PORT',
's' => 'DB_SOCKET',
];
// set env variables
foreach ($map as $opt => $env_name) {
if (isset($opts[$opt])) {
putenv("$env_name=" . $opts[$opt]);
}
}
$init_modules = ['nodb', 'laravel'];
require __DIR__ . '/includes/init.php';
set_debug(isset($opts['d']));
$skip_schema_lock = isset($opts['l']);
}

View File

@ -67,6 +67,9 @@
"ext-mysqlnd": "*"
},
"autoload": {
"classmap": [
"database"
],
"psr-4": {
"App\\": "app",
"LibreNMS\\": "LibreNMS",

View File

@ -1,32 +0,0 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreatePasswordResetsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('password_resets', function (Blueprint $table) {
$table->string('email')->index();
$table->string('token');
$table->timestamp('created_at')->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('password_resets');
}
}

View File

@ -0,0 +1,45 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateAccessPointsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('access_points', function (Blueprint $table) {
$table->increments('accesspoint_id');
$table->unsignedInteger('device_id');
$table->string('name');
$table->tinyInteger('radio_number')->nullable();
$table->string('type', 16);
$table->string('mac_addr', 24);
$table->boolean('deleted')->default(0)->index('deleted');
$table->tinyInteger('channel')->unsigned()->default(0);
$table->tinyInteger('txpow')->default(0);
$table->tinyInteger('radioutil')->default(0);
$table->smallInteger('numasoclients')->default(0);
$table->smallInteger('nummonclients')->default(0);
$table->tinyInteger('numactbssid')->default(0);
$table->tinyInteger('nummonbssid')->default(0);
$table->unsignedTinyInteger('interference');
$table->index(['name','radio_number'], 'name');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('access_points');
}
}

View File

@ -0,0 +1,33 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateAlertDeviceMapTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('alert_device_map', function (Blueprint $table) {
$table->increments('id');
$table->unsignedInteger('rule_id');
$table->unsignedInteger('device_id');
$table->unique(['rule_id','device_id'], 'alert_device_map_rule_id_device_id_uindex');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('alert_device_map');
}
}

View File

@ -0,0 +1,33 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateAlertGroupMapTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('alert_group_map', function (Blueprint $table) {
$table->increments('id');
$table->unsignedInteger('rule_id');
$table->unsignedInteger('group_id');
$table->unique(['rule_id','group_id'], 'alert_group_map_rule_id_group_id_uindex');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('alert_group_map');
}
}

View File

@ -0,0 +1,37 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateAlertLogTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('alert_log', function (Blueprint $table) {
$table->increments('id');
$table->unsignedInteger('rule_id')->index('rule_id');
$table->unsignedInteger('device_id')->index('device_id');
$table->integer('state');
$table->binary('details')->nullable();
$table->timestamp('time_logged')->default(DB::raw('CURRENT_TIMESTAMP'))->index('time_logged');
});
\DB::statement("ALTER TABLE `alert_log` CHANGE `details` `details` longblob NULL ;");
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('alert_log');
}
}

View File

@ -0,0 +1,39 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateAlertRulesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('alert_rules', function (Blueprint $table) {
$table->increments('id');
$table->text('rule', 65535);
$table->enum('severity', array('ok','warning','critical'));
$table->string('extra');
$table->boolean('disabled');
$table->string('name')->unique('name');
$table->text('query', 65535);
$table->text('builder', 65535);
$table->string('proc', 80)->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('alert_rules');
}
}

View File

@ -0,0 +1,34 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateAlertSchedulablesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('alert_schedulables', function (Blueprint $table) {
$table->increments('item_id');
$table->unsignedInteger('schedule_id')->index('schedule_id');
$table->unsignedInteger('alert_schedulable_id');
$table->string('alert_schedulable_type');
$table->index(['alert_schedulable_type', 'alert_schedulable_id'], 'schedulable_morph_index');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('alert_schedule_items');
}
}

View File

@ -0,0 +1,40 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateAlertScheduleTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('alert_schedule', function (Blueprint $table) {
$table->increments('schedule_id');
$table->boolean('recurring')->default(0)->unsigned();
$table->dateTime('start')->default('1970-01-02 00:00:01');
$table->dateTime('end')->default('1970-01-02 00:00:01');
$table->date('start_recurring_dt')->default('1970-01-01');
$table->date('end_recurring_dt')->nullable();
$table->time('start_recurring_hr')->default('00:00:00');
$table->time('end_recurring_hr')->default('00:00:00');
$table->string('recurring_day', 15)->nullable();
$table->string('title');
$table->text('notes', 65535);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('alert_schedule');
}
}

View File

@ -0,0 +1,33 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateAlertTemplateMapTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('alert_template_map', function (Blueprint $table) {
$table->increments('id');
$table->unsignedInteger('alert_templates_id');
$table->unsignedInteger('alert_rule_id');
$table->index(['alert_templates_id','alert_rule_id'], 'alert_templates_id');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('alert_template_map');
}
}

View File

@ -1,11 +1,11 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateUsersTable extends Migration
class CreateAlertTemplatesTable extends Migration
{
/**
* Run the migrations.
*
@ -13,16 +13,16 @@ class CreateUsersTable extends Migration
*/
public function up()
{
Schema::create('users', function (Blueprint $table) {
Schema::create('alert_templates', function (Blueprint $table) {
$table->increments('id');
$table->string('name');
$table->string('email')->unique();
$table->string('password');
$table->rememberToken();
$table->timestamps();
$table->longText('template');
$table->string('title')->nullable();
$table->string('title_rec')->nullable();
});
}
/**
* Reverse the migrations.
*
@ -30,6 +30,6 @@ class CreateUsersTable extends Migration
*/
public function down()
{
Schema::dropIfExists('users');
Schema::drop('alert_templates');
}
}

View File

@ -0,0 +1,55 @@
<?php
/**
* 2018_07_03_091314_create_alert_transport_groups_table.php
*
* -Description-
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @package LibreNMS
* @link http://librenms.org
* @copyright 2018 Tony Murray
* @author Tony Murray <murraytony@gmail.com>
*/
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateAlertTransportGroupsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('alert_transport_groups', function (Blueprint $table) {
$table->increments('transport_group_id');
$table->string('transport_group_name', 30);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('alert_transport_groups');
}
}

View File

@ -0,0 +1,57 @@
<?php
/**
* 2018_07_03_091314_create_alert_transport_map_table.php
*
* -Description-
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @package LibreNMS
* @link http://librenms.org
* @copyright 2018 Tony Murray
* @author Tony Murray <murraytony@gmail.com>
*/
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateAlertTransportMapTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('alert_transport_map', function (Blueprint $table) {
$table->increments('id');
$table->unsignedInteger('rule_id');
$table->unsignedInteger('transport_or_group_id');
$table->string('target_type', 16);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('alert_transport_map');
}
}

View File

@ -0,0 +1,58 @@
<?php
/**
* 2018_07_03_091314_create_alert_transports_table.php
*
* -Description-
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @package LibreNMS
* @link http://librenms.org
* @copyright 2018 Tony Murray
* @author Tony Murray <murraytony@gmail.com>
*/
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateAlertTransportsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('alert_transports', function (Blueprint $table) {
$table->increments('transport_id');
$table->string('transport_name', 30);
$table->string('transport_type', 20)->default('mail');
$table->boolean('is_default')->default(0);
$table->text('transport_config')->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('alert_transports');
}
}

View File

@ -0,0 +1,40 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateAlertsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('alerts', function (Blueprint $table) {
$table->increments('id');
$table->unsignedInteger('device_id')->index('device_id');
$table->unsignedInteger('rule_id')->index('rule_id');
$table->integer('state');
$table->integer('alerted');
$table->integer('open');
$table->text('note')->nullable();
$table->timestamp('timestamp')->default(DB::raw('CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP'));
$table->text('info');
$table->unique(['device_id','rule_id'], 'unique_alert');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('alerts');
}
}

View File

@ -0,0 +1,34 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateApiTokensTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('api_tokens', function (Blueprint $table) {
$table->increments('id');
$table->unsignedInteger('user_id');
$table->string('token_hash')->nullable()->unique('token_hash');
$table->string('description', 100);
$table->boolean('disabled')->default(0);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('api_tokens');
}
}

View File

@ -0,0 +1,34 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateApplicationMetricsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('application_metrics', function (Blueprint $table) {
$table->unsignedInteger('app_id');
$table->string('metric', 32);
$table->double('value')->nullable();
$table->double('value_prev')->nullable();
$table->unique(['app_id','metric'], 'application_metrics_app_id_metric_uindex');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('application_metrics');
}
}

View File

@ -0,0 +1,39 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateApplicationsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('applications', function (Blueprint $table) {
$table->increments('app_id');
$table->unsignedInteger('device_id');
$table->string('app_type', 64);
$table->string('app_state', 32)->default('UNKNOWN');
$table->tinyInteger('discovered')->default(0);
$table->string('app_state_prev', 32)->nullable();
$table->string('app_status', 8);
$table->timestamp('timestamp')->default(DB::raw('CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP'));
$table->string('app_instance');
$table->unique(['device_id','app_type'], 'unique_index');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('applications');
}
}

View File

@ -0,0 +1,34 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateAuthlogTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('authlog', function (Blueprint $table) {
$table->increments('id');
$table->timestamp('datetime')->default(DB::raw('CURRENT_TIMESTAMP'));
$table->text('user', 65535);
$table->text('address', 65535);
$table->text('result', 65535);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('authlog');
}
}

View File

@ -0,0 +1,54 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateBgpPeersCbgpTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('bgpPeers_cbgp', function (Blueprint $table) {
$table->unsignedInteger('device_id');
$table->string('bgpPeerIdentifier', 64);
$table->string('afi', 16);
$table->string('safi', 16);
$table->integer('AcceptedPrefixes');
$table->integer('DeniedPrefixes');
$table->integer('PrefixAdminLimit');
$table->integer('PrefixThreshold');
$table->integer('PrefixClearThreshold');
$table->integer('AdvertisedPrefixes');
$table->integer('SuppressedPrefixes');
$table->integer('WithdrawnPrefixes');
$table->integer('AcceptedPrefixes_delta');
$table->integer('AcceptedPrefixes_prev');
$table->integer('DeniedPrefixes_delta');
$table->integer('DeniedPrefixes_prev');
$table->integer('AdvertisedPrefixes_delta');
$table->integer('AdvertisedPrefixes_prev');
$table->integer('SuppressedPrefixes_delta');
$table->integer('SuppressedPrefixes_prev');
$table->integer('WithdrawnPrefixes_delta');
$table->integer('WithdrawnPrefixes_prev');
$table->string('context_name', 128)->nullable();
$table->unique(['device_id','bgpPeerIdentifier','afi','safi'], 'unique_index');
$table->index(['device_id','bgpPeerIdentifier','context_name'], 'device_id');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('bgpPeers_cbgp');
}
}

View File

@ -0,0 +1,47 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateBgpPeersTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('bgpPeers', function (Blueprint $table) {
$table->increments('bgpPeer_id');
$table->unsignedInteger('device_id');
$table->string('astext');
$table->text('bgpPeerIdentifier', 65535);
$table->bigInteger('bgpPeerRemoteAs');
$table->text('bgpPeerState', 65535);
$table->text('bgpPeerAdminStatus', 65535);
$table->text('bgpLocalAddr', 65535);
$table->text('bgpPeerRemoteAddr', 65535);
$table->string('bgpPeerDescr')->default('');
$table->integer('bgpPeerInUpdates');
$table->integer('bgpPeerOutUpdates');
$table->integer('bgpPeerInTotalMessages');
$table->integer('bgpPeerOutTotalMessages');
$table->integer('bgpPeerFsmEstablishedTime');
$table->integer('bgpPeerInUpdateElapsedTime');
$table->string('context_name', 128)->nullable();
$table->index(['device_id','context_name'], 'device_id');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('bgpPeers');
}
}

View File

@ -0,0 +1,37 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateBillDataTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('bill_data', function (Blueprint $table) {
$table->unsignedInteger('bill_id')->index('bill_id');
$table->dateTime('timestamp');
$table->integer('period');
$table->bigInteger('delta');
$table->bigInteger('in_delta');
$table->bigInteger('out_delta');
$table->primary(['bill_id','timestamp']);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('bill_data');
}
}

View File

@ -0,0 +1,53 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateBillHistoryTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('bill_history', function (Blueprint $table) {
$table->increments('bill_hist_id');
$table->unsignedInteger('bill_id')->index('bill_id');
$table->timestamp('updated')->default(DB::raw('CURRENT_TIMESTAMP'));
$table->dateTime('bill_datefrom');
$table->dateTime('bill_dateto');
$table->text('bill_type');
$table->bigInteger('bill_allowed');
$table->bigInteger('bill_used');
$table->bigInteger('bill_overuse');
$table->decimal('bill_percent', 10);
$table->bigInteger('rate_95th_in');
$table->bigInteger('rate_95th_out');
$table->bigInteger('rate_95th');
$table->string('dir_95th', 3);
$table->bigInteger('rate_average');
$table->bigInteger('rate_average_in');
$table->bigInteger('rate_average_out');
$table->bigInteger('traf_in');
$table->bigInteger('traf_out');
$table->bigInteger('traf_total');
$table->binary('pdf')->nullable();
$table->unique(['bill_id','bill_datefrom','bill_dateto'], 'unique_index');
});
\DB::statement("ALTER TABLE `bill_history` CHANGE `pdf` `pdf` longblob NULL ;");
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('bill_history');
}
}

View File

@ -0,0 +1,31 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateBillPermsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('bill_perms', function (Blueprint $table) {
$table->unsignedInteger('user_id');
$table->unsignedInteger('bill_id');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('bill_perms');
}
}

View File

@ -0,0 +1,37 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateBillPortCountersTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('bill_port_counters', function (Blueprint $table) {
$table->unsignedInteger('port_id');
$table->timestamp('timestamp')->default(DB::raw('CURRENT_TIMESTAMP'));
$table->bigInteger('in_counter')->nullable();
$table->bigInteger('in_delta')->default(0);
$table->bigInteger('out_counter')->nullable();
$table->bigInteger('out_delta')->default(0);
$table->unsignedInteger('bill_id');
$table->primary(['port_id','bill_id']);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('bill_port_counters');
}
}

View File

@ -0,0 +1,32 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateBillPortsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('bill_ports', function (Blueprint $table) {
$table->unsignedInteger('bill_id');
$table->unsignedInteger('port_id');
$table->boolean('bill_port_autoadded')->default(0);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('bill_ports');
}
}

View File

@ -0,0 +1,50 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateBillsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('bills', function (Blueprint $table) {
$table->increments('bill_id');
$table->text('bill_name', 65535);
$table->text('bill_type', 65535);
$table->bigInteger('bill_cdr')->nullable();
$table->integer('bill_day')->default(1);
$table->bigInteger('bill_quota')->nullable();
$table->bigInteger('rate_95th_in');
$table->bigInteger('rate_95th_out');
$table->bigInteger('rate_95th');
$table->string('dir_95th', 3);
$table->bigInteger('total_data');
$table->bigInteger('total_data_in');
$table->bigInteger('total_data_out');
$table->bigInteger('rate_average_in');
$table->bigInteger('rate_average_out');
$table->bigInteger('rate_average');
$table->dateTime('bill_last_calc');
$table->string('bill_custid', 64);
$table->string('bill_ref', 64);
$table->string('bill_notes', 256);
$table->boolean('bill_autoadded');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('bills');
}
}

View File

@ -0,0 +1,32 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateCallbackTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('callback', function (Blueprint $table) {
$table->increments('callback_id');
$table->char('name', 64);
$table->char('value', 64);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('callback');
}
}

View File

@ -0,0 +1,44 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateCefSwitchingTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('cef_switching', function (Blueprint $table) {
$table->increments('cef_switching_id');
$table->unsignedInteger('device_id');
$table->integer('entPhysicalIndex');
$table->string('afi', 4);
$table->integer('cef_index');
$table->string('cef_path', 16);
$table->integer('drop');
$table->integer('punt');
$table->integer('punt2host');
$table->integer('drop_prev');
$table->integer('punt_prev');
$table->integer('punt2host_prev');
$table->unsignedInteger('updated');
$table->unsignedInteger('updated_prev');
$table->unique(['device_id','entPhysicalIndex','afi','cef_index'], 'device_id');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('cef_switching');
}
}

View File

@ -0,0 +1,36 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateCiscoASATable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('ciscoASA', function (Blueprint $table) {
$table->increments('ciscoASA_id');
$table->unsignedInteger('device_id')->index('device_id');
$table->string('oid');
$table->bigInteger('data');
$table->bigInteger('high_alert');
$table->bigInteger('low_alert');
$table->tinyInteger('disabled')->default(0);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('ciscoASA');
}
}

View File

@ -0,0 +1,33 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateComponentPrefsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('component_prefs', function (Blueprint $table) {
$table->increments('id')->comment('ID for each entry');
$table->unsignedInteger('component')->index('component')->comment('id from the component table');
$table->string('attribute')->comment('Attribute for the Component');
$table->text('value')->comment('Value for the Component');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('component_prefs');
}
}

View File

@ -0,0 +1,34 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateComponentStatuslogTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('component_statuslog', function (Blueprint $table) {
$table->increments('id')->comment('ID for each log entry, unique index');
$table->unsignedInteger('component_id')->index('device')->comment('id from the component table');
$table->boolean('status')->default(0)->comment('The status that the component was changed TO');
$table->text('message')->nullable();
$table->timestamp('timestamp')->default(DB::raw('CURRENT_TIMESTAMP'))->comment('When the status of the component was changed');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('component_statuslog');
}
}

View File

@ -0,0 +1,37 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateComponentTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('component', function (Blueprint $table) {
$table->increments('id')->comment('ID for each component, unique index');
$table->unsignedInteger('device_id')->index('device')->comment('device_id from the devices table');
$table->string('type', 50)->index('type')->comment('name from the component_type table');
$table->string('label')->nullable()->comment('Display label for the component');
$table->boolean('status')->default(0)->comment('The status of the component, retreived from the device');
$table->boolean('disabled')->default(0)->comment('Should this component be polled');
$table->boolean('ignore')->default(0)->comment('Should this component be alerted on');
$table->string('error')->nullable()->comment('Error message if in Alert state');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('component');
}
}

View File

@ -0,0 +1,40 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateConfigTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('config', function (Blueprint $table) {
$table->increments('config_id');
$table->string('config_name')->unique('uniqueindex_configname');
$table->string('config_value', 512);
$table->string('config_default', 512);
$table->string('config_descr', 100);
$table->string('config_group', 50);
$table->integer('config_group_order')->default(0);
$table->string('config_sub_group', 50);
$table->integer('config_sub_group_order')->default(0);
$table->enum('config_hidden', array('0','1'))->default('0');
$table->enum('config_disabled', array('0','1'))->default('0');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('config');
}
}

View File

@ -0,0 +1,34 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateCustomersTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('customers', function (Blueprint $table) {
$table->increments('customer_id');
$table->char('username', 64)->unique('username');
$table->char('password', 32);
$table->char('string', 64);
$table->tinyInteger('level')->default(0);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('customers');
}
}

View File

@ -0,0 +1,33 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateDashboardsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('dashboards', function (Blueprint $table) {
$table->increments('dashboard_id');
$table->unsignedInteger('user_id')->default(0);
$table->string('dashboard_name');
$table->boolean('access')->default(0);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('dashboards');
}
}

View File

@ -0,0 +1,30 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateDbSchemaTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('dbSchema', function (Blueprint $table) {
$table->integer('version')->default(0)->primary();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('dbSchema');
}
}

View File

@ -0,0 +1,31 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateDeviceGraphsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('device_graphs', function (Blueprint $table) {
$table->unsignedInteger('device_id')->index('device_id');
$table->string('graph')->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('device_graphs');
}
}

View File

@ -0,0 +1,32 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateDeviceGroupDeviceTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('device_group_device', function (Blueprint $table) {
$table->unsignedInteger('device_group_id')->unsigned()->index();
$table->unsignedInteger('device_id')->unsigned()->index();
$table->primary(['device_group_id','device_id']);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('device_group_device');
}
}

View File

@ -0,0 +1,34 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateDeviceGroupsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('device_groups', function (Blueprint $table) {
$table->increments('id');
$table->string('name')->default('')->unique('name');
$table->string('desc')->default('');
$table->text('pattern')->nullable();
$table->text('params')->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('device_groups');
}
}

View File

@ -0,0 +1,35 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateDeviceMibsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('device_mibs', function (Blueprint $table) {
$table->unsignedInteger('device_id');
$table->string('module');
$table->string('mib');
$table->string('included_by');
$table->timestamp('last_modified')->default(DB::raw('CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP'));
$table->primary(['device_id','module','mib']);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('device_mibs');
}
}

View File

@ -0,0 +1,38 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateDeviceOidsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('device_oids', function (Blueprint $table) {
$table->unsignedInteger('device_id');
$table->string('oid');
$table->string('module');
$table->string('mib');
$table->string('object_type');
$table->string('value')->nullable();
$table->bigInteger('numvalue')->nullable();
$table->timestamp('last_modified')->default(DB::raw('CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP'));
$table->primary(['device_id','oid']);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('device_oids');
}
}

View File

@ -0,0 +1,39 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateDevicePerfTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('device_perf', function (Blueprint $table) {
$table->increments('id');
$table->unsignedInteger('device_id')->index('device_id');
$table->dateTime('timestamp');
$table->integer('xmt');
$table->integer('rcv');
$table->integer('loss');
$table->float('min');
$table->float('max');
$table->float('avg');
$table->text('debug')->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('device_perf');
}
}

View File

@ -0,0 +1,32 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateDeviceRelationshipsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('device_relationships', function (Blueprint $table) {
$table->unsignedInteger('parent_device_id')->default(0);
$table->unsignedInteger('child_device_id')->index('device_relationship_child_device_id_fk');
$table->primary(['parent_device_id','child_device_id']);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('device_relationships');
}
}

View File

@ -0,0 +1,34 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateDevicesAttribsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('devices_attribs', function (Blueprint $table) {
$table->increments('attrib_id');
$table->unsignedInteger('device_id')->index('device_id');
$table->string('attrib_type', 32);
$table->text('attrib_value', 65535);
$table->timestamp('updated')->default(DB::raw('CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP'));
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('devices_attribs');
}
}

View File

@ -0,0 +1,31 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateDevicesPermsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('devices_perms', function (Blueprint $table) {
$table->unsignedInteger('user_id')->index('user_id');
$table->unsignedInteger('device_id');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('devices_perms');
}
}

View File

@ -0,0 +1,79 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateDevicesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('devices', function (Blueprint $table) {
$table->increments('device_id');
$table->string('hostname', 128)->index('hostname');
$table->string('sysName', 128)->nullable()->index('sysName');
$table->binary('ip')->nullable();
$table->string('community')->nullable();
$table->enum('authlevel', array('noAuthNoPriv','authNoPriv','authPriv'))->nullable();
$table->string('authname', 64)->nullable();
$table->string('authpass', 64)->nullable();
$table->enum('authalgo', array('MD5','SHA'))->nullable();
$table->string('cryptopass', 64)->nullable();
$table->enum('cryptoalgo', array('AES','DES',''))->nullable();
$table->string('snmpver', 4)->default('v2c');
$table->smallInteger('port')->unsigned()->default(161);
$table->string('transport', 16)->default('udp');
$table->integer('timeout')->nullable();
$table->integer('retries')->nullable();
$table->boolean('snmp_disable')->default(0);
$table->unsignedInteger('bgpLocalAs')->nullable();
$table->string('sysObjectID', 128)->nullable();
$table->text('sysDescr')->nullable();
$table->text('sysContact')->nullable();
$table->text('version')->nullable();
$table->text('hardware')->nullable();
$table->text('features')->nullable();
$table->unsignedInteger('location_id')->nullable();
$table->string('os', 32)->nullable()->index('os');
$table->boolean('status')->default(0)->index('status');
$table->string('status_reason', 50);
$table->boolean('ignore')->default(0);
$table->boolean('disabled')->default(0);
$table->bigInteger('uptime')->nullable();
$table->unsignedInteger('agent_uptime')->default(0);
$table->timestamp('last_polled')->nullable()->index('last_polled');
$table->timestamp('last_poll_attempted')->nullable()->index('last_poll_attempted');
$table->float('last_polled_timetaken', 5)->nullable();
$table->float('last_discovered_timetaken', 5)->nullable();
$table->timestamp('last_discovered')->nullable();
$table->timestamp('last_ping')->nullable();
$table->float('last_ping_timetaken')->nullable();
$table->text('purpose', 65535)->nullable();
$table->string('type', 20)->default('');
$table->text('serial', 65535)->nullable();
$table->string('icon')->nullable();
$table->integer('poller_group')->default(0);
$table->boolean('override_sysLocation')->nullable()->default(0);
$table->text('notes', 65535)->nullable();
$table->integer('port_association_mode')->default(1);
$table->integer('max_depth')->default(0);
});
\DB::statement("ALTER TABLE `devices` CHANGE `ip` `ip` varbinary(16) NULL ;");
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('devices');
}
}

View File

@ -0,0 +1,36 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateEntPhysicalStateTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('entPhysical_state', function (Blueprint $table) {
$table->unsignedInteger('device_id');
$table->string('entPhysicalIndex', 64);
$table->string('subindex', 64)->nullable();
$table->string('group', 64);
$table->string('key', 64);
$table->string('value');
$table->index(['device_id','entPhysicalIndex'], 'device_id_index');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('entPhysical_state');
}
}

View File

@ -0,0 +1,48 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateEntPhysicalTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('entPhysical', function (Blueprint $table) {
$table->increments('entPhysical_id');
$table->unsignedInteger('device_id')->index('device_id');
$table->integer('entPhysicalIndex');
$table->text('entPhysicalDescr', 65535);
$table->text('entPhysicalClass', 65535);
$table->text('entPhysicalName', 65535);
$table->string('entPhysicalHardwareRev', 64)->nullable();
$table->string('entPhysicalFirmwareRev', 64)->nullable();
$table->string('entPhysicalSoftwareRev', 64)->nullable();
$table->string('entPhysicalAlias', 32)->nullable();
$table->string('entPhysicalAssetID', 32)->nullable();
$table->string('entPhysicalIsFRU', 8)->nullable();
$table->text('entPhysicalModelName', 65535);
$table->text('entPhysicalVendorType', 65535)->nullable();
$table->text('entPhysicalSerialNum', 65535);
$table->integer('entPhysicalContainedIn');
$table->integer('entPhysicalParentRelPos');
$table->text('entPhysicalMfgName', 65535);
$table->integer('ifIndex')->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('entPhysical');
}
}

View File

@ -0,0 +1,39 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateEntityStateTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('entityState', function (Blueprint $table) {
$table->increments('entity_state_id');
$table->unsignedInteger('device_id')->nullable();
$table->unsignedInteger('entPhysical_id')->nullable();
$table->dateTime('entStateLastChanged')->nullable();
$table->integer('entStateAdmin')->nullable();
$table->integer('entStateOper')->nullable();
$table->integer('entStateUsage')->nullable();
$table->text('entStateAlarm')->nullable();
$table->integer('entStateStandby')->nullable();
$table->index('device_id', 'entityState_device_id_index');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('entityState');
}
}

View File

@ -0,0 +1,37 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateEventlogTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('eventlog', function (Blueprint $table) {
$table->increments('event_id');
$table->unsignedInteger('device_id')->nullable()->index('device_id');
$table->dateTime('datetime')->default('1970-01-02 00:00:01')->index('datetime');
$table->text('message')->nullable();
$table->string('type', 64)->nullable();
$table->string('reference', 64)->nullable();
$table->string('username', 128)->nullable();
$table->tinyInteger('severity')->default(2);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('eventlog');
}
}

View File

@ -0,0 +1,35 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateGraphTypesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('graph_types', function (Blueprint $table) {
$table->string('graph_type', 32)->index('graph_type');
$table->string('graph_subtype', 64)->index('graph_subtype');
$table->string('graph_section', 32)->index('graph_section');
$table->string('graph_descr')->nullable();
$table->integer('graph_order');
$table->primary(['graph_type','graph_subtype','graph_section']);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('graph_types');
}
}

View File

@ -0,0 +1,37 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateHrDeviceTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('hrDevice', function (Blueprint $table) {
$table->increments('hrDevice_id');
$table->unsignedInteger('device_id')->index('device_id');
$table->integer('hrDeviceIndex');
$table->text('hrDeviceDescr');
$table->text('hrDeviceType');
$table->integer('hrDeviceErrors')->default(0);
$table->text('hrDeviceStatus');
$table->tinyInteger('hrProcessorLoad')->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('hrDevice');
}
}

View File

@ -0,0 +1,38 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateIpsecTunnelsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('ipsec_tunnels', function (Blueprint $table) {
$table->increments('tunnel_id');
$table->unsignedInteger('device_id');
$table->unsignedInteger('peer_port');
$table->string('peer_addr', 64);
$table->string('local_addr', 64);
$table->unsignedInteger('local_port');
$table->string('tunnel_name', 96);
$table->string('tunnel_status', 11);
$table->unique(['device_id','peer_addr'], 'unique_index');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('ipsec_tunnels');
}
}

View File

@ -0,0 +1,35 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateIpv4AddressesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('ipv4_addresses', function (Blueprint $table) {
$table->increments('ipv4_address_id');
$table->string('ipv4_address', 32);
$table->integer('ipv4_prefixlen');
$table->string('ipv4_network_id', 32);
$table->unsignedInteger('port_id')->index('interface_id');
$table->string('context_name', 128)->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('ipv4_addresses');
}
}

View File

@ -0,0 +1,34 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateIpv4MacTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('ipv4_mac', function (Blueprint $table) {
$table->unsignedInteger('port_id')->index('port_id');
$table->unsignedInteger('device_id')->nullable();
$table->string('mac_address', 32)->index('mac_address');
$table->string('ipv4_address', 32);
$table->string('context_name', 128);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('ipv4_mac');
}
}

View File

@ -0,0 +1,32 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateIpv4NetworksTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('ipv4_networks', function (Blueprint $table) {
$table->increments('ipv4_network_id');
$table->string('ipv4_network', 64);
$table->string('context_name', 128)->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('ipv4_networks');
}
}

View File

@ -0,0 +1,37 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateIpv6AddressesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('ipv6_addresses', function (Blueprint $table) {
$table->increments('ipv6_address_id');
$table->string('ipv6_address', 128);
$table->string('ipv6_compressed', 128);
$table->integer('ipv6_prefixlen');
$table->string('ipv6_origin', 16);
$table->string('ipv6_network_id', 128);
$table->unsignedInteger('port_id')->index('interface_id');
$table->string('context_name', 128)->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('ipv6_addresses');
}
}

View File

@ -0,0 +1,32 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateIpv6NetworksTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('ipv6_networks', function (Blueprint $table) {
$table->increments('ipv6_network_id');
$table->string('ipv6_network', 64);
$table->string('context_name', 128)->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('ipv6_networks');
}
}

View File

@ -0,0 +1,33 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateJuniAtmVpTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('juniAtmVp', function (Blueprint $table) {
$table->unsignedInteger('juniAtmVp_id');
$table->unsignedInteger('port_id')->index('port_id');
$table->unsignedInteger('vp_id');
$table->string('vp_descr', 32);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('juniAtmVp');
}
}

View File

@ -0,0 +1,42 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateLinksTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('links', function (Blueprint $table) {
$table->increments('id');
$table->unsignedInteger('local_port_id')->nullable()->index('src_if');
$table->unsignedInteger('local_device_id');
$table->unsignedInteger('remote_port_id')->nullable()->index('dst_if');
$table->boolean('active')->default(1);
$table->string('protocol', 11)->nullable();
$table->string('remote_hostname', 128);
$table->unsignedInteger('remote_device_id');
$table->string('remote_port', 128);
$table->string('remote_platform', 256)->nullable();
$table->string('remote_version', 256);
$table->index(['local_device_id','remote_device_id'], 'local_device_id');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('links');
}
}

View File

@ -0,0 +1,33 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateLoadbalancerRserversTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('loadbalancer_rservers', function (Blueprint $table) {
$table->increments('rserver_id');
$table->string('farm_id', 128);
$table->unsignedInteger('device_id');
$table->string('StateDescr', 64);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('loadbalancer_rservers');
}
}

View File

@ -0,0 +1,33 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateLoadbalancerVserversTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('loadbalancer_vservers', function (Blueprint $table) {
$table->unsignedInteger('classmap_id');
$table->string('classmap', 128);
$table->string('serverstate', 64);
$table->unsignedInteger('device_id')->index('device_id');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('loadbalancer_vservers');
}
}

View File

@ -0,0 +1,34 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateLocationsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('locations', function (Blueprint $table) {
$table->increments('id');
$table->string('location')->unique('locations_location_uindex');
$table->float('lat', 10, 6)->nullable();
$table->float('lng', 10, 6)->nullable();
$table->dateTime('timestamp');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('locations');
}
}

View File

@ -0,0 +1,56 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateMacAccountingTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('mac_accounting', function (Blueprint $table) {
$table->increments('ma_id');
$table->unsignedInteger('port_id')->index('interface_id_2');
$table->string('mac', 32);
$table->string('in_oid', 128);
$table->string('out_oid', 128);
$table->integer('bps_out');
$table->integer('bps_in');
$table->bigInteger('cipMacHCSwitchedBytes_input')->nullable();
$table->bigInteger('cipMacHCSwitchedBytes_input_prev')->nullable();
$table->bigInteger('cipMacHCSwitchedBytes_input_delta')->nullable();
$table->integer('cipMacHCSwitchedBytes_input_rate')->nullable();
$table->bigInteger('cipMacHCSwitchedBytes_output')->nullable();
$table->bigInteger('cipMacHCSwitchedBytes_output_prev')->nullable();
$table->bigInteger('cipMacHCSwitchedBytes_output_delta')->nullable();
$table->integer('cipMacHCSwitchedBytes_output_rate')->nullable();
$table->bigInteger('cipMacHCSwitchedPkts_input')->nullable();
$table->bigInteger('cipMacHCSwitchedPkts_input_prev')->nullable();
$table->bigInteger('cipMacHCSwitchedPkts_input_delta')->nullable();
$table->integer('cipMacHCSwitchedPkts_input_rate')->nullable();
$table->bigInteger('cipMacHCSwitchedPkts_output')->nullable();
$table->bigInteger('cipMacHCSwitchedPkts_output_prev')->nullable();
$table->bigInteger('cipMacHCSwitchedPkts_output_delta')->nullable();
$table->integer('cipMacHCSwitchedPkts_output_rate')->nullable();
$table->unsignedInteger('poll_time')->nullable();
$table->unsignedInteger('poll_prev')->nullable();
$table->unsignedInteger('poll_period')->nullable();
$table->index('port_id', 'interface_id');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('mac_accounting');
}
}

View File

@ -0,0 +1,37 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateMefinfoTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('mefinfo', function (Blueprint $table) {
$table->increments('id');
$table->unsignedInteger('device_id')->index('device_id');
$table->integer('mefID')->index('mefID');
$table->string('mefType', 128);
$table->string('mefIdent', 128);
$table->integer('mefMTU')->default(1500);
$table->string('mefAdmState', 128);
$table->string('mefRowState', 128);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('mefinfo');
}
}

View File

@ -0,0 +1,45 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateMempoolsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('mempools', function (Blueprint $table) {
$table->increments('mempool_id');
$table->string('mempool_index', 16);
$table->integer('entPhysicalIndex')->nullable();
$table->integer('hrDeviceIndex')->nullable();
$table->string('mempool_type', 32);
$table->integer('mempool_precision')->default(1);
$table->string('mempool_descr', 64);
$table->unsignedInteger('device_id')->index('device_id');
$table->integer('mempool_perc');
$table->bigInteger('mempool_used');
$table->bigInteger('mempool_free');
$table->bigInteger('mempool_total');
$table->bigInteger('mempool_largestfree')->nullable();
$table->bigInteger('mempool_lowestfree')->nullable();
$table->boolean('mempool_deleted')->default(0);
$table->integer('mempool_perc_warn')->nullable()->default(75);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('mempools');
}
}

View File

@ -0,0 +1,40 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateMibdefsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('mibdefs', function (Blueprint $table) {
$table->string('module');
$table->string('mib');
$table->string('object_type');
$table->string('oid');
$table->string('syntax');
$table->string('description')->nullable();
$table->string('max_access')->nullable();
$table->string('status')->nullable();
$table->string('included_by');
$table->timestamp('last_modified')->default(DB::raw('CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP'));
$table->primary(['module','mib','object_type']);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('mibdefs');
}
}

View File

@ -0,0 +1,48 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateMuninPluginsDsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('munin_plugins_ds', function (Blueprint $table) {
$table->unsignedInteger('mplug_id');
$table->string('ds_name', 32);
$table->enum('ds_type', array('COUNTER','ABSOLUTE','DERIVE','GAUGE'))->default('GAUGE');
$table->string('ds_label', 64);
$table->string('ds_cdef');
$table->string('ds_draw', 64);
$table->enum('ds_graph', array('no','yes'))->default('yes');
$table->string('ds_info');
$table->text('ds_extinfo', 65535);
$table->string('ds_max', 32);
$table->string('ds_min', 32);
$table->string('ds_negative', 32);
$table->string('ds_warning', 32);
$table->string('ds_critical', 32);
$table->string('ds_colour', 32);
$table->text('ds_sum', 65535);
$table->text('ds_stack', 65535);
$table->string('ds_line', 64);
$table->unique(['mplug_id','ds_name'], 'splug_id');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('munin_plugins_ds');
}
}

View File

@ -0,0 +1,41 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateMuninPluginsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('munin_plugins', function (Blueprint $table) {
$table->increments('mplug_id');
$table->unsignedInteger('device_id')->index('device_id');
$table->string('mplug_type');
$table->string('mplug_instance', 128)->nullable();
$table->string('mplug_category', 32)->nullable();
$table->string('mplug_title', 128)->nullable();
$table->text('mplug_info')->nullable();
$table->string('mplug_vlabel', 128)->nullable();
$table->string('mplug_args', 512)->nullable();
$table->boolean('mplug_total')->default(0);
$table->boolean('mplug_graph')->default(1);
$table->unique(['device_id','mplug_type'], 'UNIQUE');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('munin_plugins');
}
}

View File

@ -0,0 +1,41 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateNetscalerVserversTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('netscaler_vservers', function (Blueprint $table) {
$table->increments('vsvr_id');
$table->unsignedInteger('device_id');
$table->string('vsvr_name', 128);
$table->string('vsvr_ip', 128);
$table->integer('vsvr_port');
$table->string('vsvr_type', 64);
$table->string('vsvr_state', 32);
$table->integer('vsvr_clients');
$table->integer('vsvr_server');
$table->integer('vsvr_req_rate');
$table->integer('vsvr_bps_in');
$table->integer('vsvr_bps_out');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('netscaler_vservers');
}
}

View File

@ -0,0 +1,34 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateNotificationsAttribsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('notifications_attribs', function (Blueprint $table) {
$table->increments('attrib_id');
$table->unsignedInteger('notifications_id');
$table->unsignedInteger('user_id');
$table->string('key')->default('');
$table->string('value')->default('');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('notifications_attribs');
}
}

View File

@ -0,0 +1,36 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateNotificationsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('notifications', function (Blueprint $table) {
$table->increments('notifications_id');
$table->string('title')->default('');
$table->text('body', 65535);
$table->integer('severity')->nullable()->default(0)->index()->comment('0=ok,1=warning,2=critical');
$table->string('source')->default('');
$table->string('checksum', 128)->unique('checksum');
$table->timestamp('datetime')->default('1970-01-02 00:00:00');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('notifications');
}
}

View File

@ -0,0 +1,43 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateOspfAreasTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('ospf_areas', function (Blueprint $table) {
$table->increments('id');
$table->unsignedInteger('device_id');
$table->string('ospfAreaId', 32);
$table->string('ospfAuthType', 64);
$table->string('ospfImportAsExtern', 128);
$table->integer('ospfSpfRuns');
$table->integer('ospfAreaBdrRtrCount');
$table->integer('ospfAsBdrRtrCount');
$table->integer('ospfAreaLsaCount');
$table->integer('ospfAreaLsaCksumSum');
$table->string('ospfAreaSummary', 64);
$table->string('ospfAreaStatus', 64);
$table->string('context_name', 128)->nullable();
$table->unique(['device_id','ospfAreaId','context_name'], 'device_area');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('ospf_areas');
}
}

View File

@ -0,0 +1,48 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateOspfInstancesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('ospf_instances', function (Blueprint $table) {
$table->increments('id');
$table->unsignedInteger('device_id');
$table->unsignedInteger('ospf_instance_id');
$table->string('ospfRouterId', 32);
$table->string('ospfAdminStat', 32);
$table->string('ospfVersionNumber', 32);
$table->string('ospfAreaBdrRtrStatus', 32);
$table->string('ospfASBdrRtrStatus', 32);
$table->integer('ospfExternLsaCount');
$table->integer('ospfExternLsaCksumSum');
$table->string('ospfTOSSupport', 32);
$table->integer('ospfOriginateNewLsas');
$table->integer('ospfRxNewLsas');
$table->integer('ospfExtLsdbLimit')->nullable();
$table->integer('ospfMulticastExtensions')->nullable();
$table->integer('ospfExitOverflowInterval')->nullable();
$table->string('ospfDemandExtensions', 32)->nullable();
$table->string('context_name', 128)->nullable();
$table->unique(['device_id','ospf_instance_id','context_name'], 'device_id');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('ospf_instances');
}
}

View File

@ -0,0 +1,46 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateOspfNbrsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('ospf_nbrs', function (Blueprint $table) {
$table->increments('id');
$table->unsignedInteger('device_id');
$table->unsignedInteger('port_id')->nullable();
$table->string('ospf_nbr_id', 32);
$table->string('ospfNbrIpAddr', 32);
$table->integer('ospfNbrAddressLessIndex');
$table->string('ospfNbrRtrId', 32);
$table->integer('ospfNbrOptions');
$table->integer('ospfNbrPriority');
$table->string('ospfNbrState', 32);
$table->integer('ospfNbrEvents');
$table->integer('ospfNbrLsRetransQLen');
$table->string('ospfNbmaNbrStatus', 32);
$table->string('ospfNbmaNbrPermanence', 32);
$table->string('ospfNbrHelloSuppressed', 32);
$table->string('context_name', 128)->nullable();
$table->unique(['device_id','ospf_nbr_id','context_name'], 'device_id');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('ospf_nbrs');
}
}

View File

@ -0,0 +1,55 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateOspfPortsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('ospf_ports', function (Blueprint $table) {
$table->increments('id');
$table->unsignedInteger('device_id');
$table->unsignedInteger('port_id');
$table->string('ospf_port_id', 32);
$table->string('ospfIfIpAddress', 32);
$table->integer('ospfAddressLessIf');
$table->string('ospfIfAreaId', 32);
$table->string('ospfIfType', 32)->nullable();
$table->string('ospfIfAdminStat', 32)->nullable();
$table->integer('ospfIfRtrPriority')->nullable();
$table->integer('ospfIfTransitDelay')->nullable();
$table->integer('ospfIfRetransInterval')->nullable();
$table->integer('ospfIfHelloInterval')->nullable();
$table->integer('ospfIfRtrDeadInterval')->nullable();
$table->integer('ospfIfPollInterval')->nullable();
$table->string('ospfIfState', 32)->nullable();
$table->string('ospfIfDesignatedRouter', 32)->nullable();
$table->string('ospfIfBackupDesignatedRouter', 32)->nullable();
$table->integer('ospfIfEvents')->nullable();
$table->string('ospfIfAuthKey', 128)->nullable();
$table->string('ospfIfStatus', 32)->nullable();
$table->string('ospfIfMulticastForwarding', 32)->nullable();
$table->string('ospfIfDemand', 32)->nullable();
$table->string('ospfIfAuthType', 32)->nullable();
$table->string('context_name', 128)->nullable();
$table->unique(['device_id','ospf_port_id','context_name'], 'device_id');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('ospf_ports');
}
}

View File

@ -0,0 +1,39 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreatePackagesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('packages', function (Blueprint $table) {
$table->increments('pkg_id');
$table->unsignedInteger('device_id')->index('device_id');
$table->string('name', 64);
$table->string('manager', 16)->default('1');
$table->boolean('status');
$table->string('version');
$table->string('build', 64);
$table->string('arch', 16);
$table->bigInteger('size')->nullable();
$table->unique(['device_id','name','manager','arch','version','build'], 'unique_key');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('packages');
}
}

View File

@ -0,0 +1,37 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreatePdbIxPeersTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('pdb_ix_peers', function (Blueprint $table) {
$table->increments('pdb_ix_peers_id');
$table->unsignedInteger('ix_id');
$table->unsignedInteger('peer_id');
$table->unsignedInteger('remote_asn');
$table->string('remote_ipaddr4', 15)->nullable();
$table->string('remote_ipaddr6', 128)->nullable();
$table->string('name')->nullable();
$table->integer('timestamp')->unsigned()->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('pdb_ix_peers');
}
}

View File

@ -0,0 +1,34 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreatePdbIxTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('pdb_ix', function (Blueprint $table) {
$table->increments('pdb_ix_id');
$table->unsignedInteger('ix_id')->unsigned();
$table->string('name');
$table->integer('asn')->unsigned();
$table->integer('timestamp')->unsigned();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('pdb_ix');
}
}

View File

@ -0,0 +1,36 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreatePerfTimesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('perf_times', function (Blueprint $table) {
$table->increments('id');
$table->string('type', 8)->index('type');
$table->string('doing', 64);
$table->unsignedInteger('start');
$table->float('duration');
$table->unsignedInteger('devices');
$table->string('poller');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('perf_times');
}
}

View File

@ -0,0 +1,32 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreatePluginsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('plugins', function (Blueprint $table) {
$table->increments('plugin_id');
$table->string('plugin_name', 60);
$table->integer('plugin_active');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('plugins');
}
}

View File

@ -0,0 +1,38 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreatePollerClusterStatsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('poller_cluster_stats', function (Blueprint $table) {
$table->increments('id');
$table->unsignedInteger('parent_poller')->default(0);
$table->string('poller_type', 64)->default('');
$table->unsignedInteger('depth');
$table->unsignedInteger('devices');
$table->double('worker_seconds')->unsigned();
$table->unsignedInteger('workers');
$table->unsignedInteger('frequency');
$table->unique(['parent_poller', 'poller_type'], 'parent_poller_poller_type');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('poller_cluster_stats');
}
}

View File

@ -0,0 +1,36 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreatePollerClusterTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('poller_cluster', function (Blueprint $table) {
$table->increments('id');
$table->string('node_id')->unique();
$table->string('poller_name');
$table->string('poller_version')->default('');
$table->string('poller_groups')->default('');
$table->dateTime('last_report');
$table->boolean('master');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('poller_cluster');
}
}

View File

@ -0,0 +1,32 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreatePollerGroupsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('poller_groups', function (Blueprint $table) {
$table->increments('id');
$table->string('group_name');
$table->string('descr');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('poller_groups');
}
}

View File

@ -0,0 +1,34 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreatePollersTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('pollers', function (Blueprint $table) {
$table->increments('id');
$table->string('poller_name')->unique('poller_name');
$table->dateTime('last_polled');
$table->unsignedInteger('devices');
$table->float('time_taken', 10, 0);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('pollers');
}
}

View File

@ -0,0 +1,48 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreatePortsAdslTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('ports_adsl', function (Blueprint $table) {
$table->unsignedInteger('port_id')->unique('interface_id');
$table->timestamp('port_adsl_updated')->default(DB::raw('CURRENT_TIMESTAMP'));
$table->string('adslLineCoding', 8);
$table->string('adslLineType', 16);
$table->string('adslAtucInvVendorID', 8);
$table->string('adslAtucInvVersionNumber', 8);
$table->decimal('adslAtucCurrSnrMgn', 5, 1);
$table->decimal('adslAtucCurrAtn', 5, 1);
$table->decimal('adslAtucCurrOutputPwr', 5, 1);
$table->integer('adslAtucCurrAttainableRate');
$table->integer('adslAtucChanCurrTxRate');
$table->string('adslAturInvSerialNumber', 8);
$table->string('adslAturInvVendorID', 8);
$table->string('adslAturInvVersionNumber', 8);
$table->integer('adslAturChanCurrTxRate');
$table->decimal('adslAturCurrSnrMgn', 5, 1);
$table->decimal('adslAturCurrAtn', 5, 1);
$table->decimal('adslAturCurrOutputPwr', 5, 1);
$table->integer('adslAturCurrAttainableRate');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('ports_adsl');
}
}

View File

@ -0,0 +1,34 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreatePortsFdbTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('ports_fdb', function (Blueprint $table) {
$table->unsignedBigInteger('ports_fdb_id', true);
$table->unsignedInteger('port_id')->index();
$table->string('mac_address', 32)->index('mac_address');
$table->unsignedInteger('vlan_id')->index();
$table->unsignedInteger('device_id')->index();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('ports_fdb');
}
}

View File

@ -0,0 +1,45 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreatePortsNacTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('ports_nac', function (Blueprint $table) {
$table->increments('ports_nac_id');
$table->string('auth_id', 50);
$table->unsignedInteger('device_id')->index('ports_nac_device_id_index');
$table->unsignedInteger('port_id');
$table->string('domain', 50);
$table->string('username', 50);
$table->string('mac_address', 50);
$table->string('ip_address', 50);
$table->string('host_mode', 50);
$table->string('authz_status', 50);
$table->string('authz_by', 50);
$table->string('authc_status', 50);
$table->string('method', 50);
$table->string('timeout', 50);
$table->string('time_left', 50);
$table->index(['port_id', 'mac_address']);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('ports_nac');
}
}

View File

@ -0,0 +1,31 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreatePortsPermsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('ports_perms', function (Blueprint $table) {
$table->unsignedInteger('user_id');
$table->unsignedInteger('port_id');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('ports_perms');
}
}

View File

@ -0,0 +1,34 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreatePortsStackTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('ports_stack', function (Blueprint $table) {
$table->unsignedInteger('device_id');
$table->unsignedInteger('port_id_high');
$table->unsignedInteger('port_id_low');
$table->string('ifStackStatus', 32);
$table->unique(['device_id','port_id_high','port_id_low'], 'device_id');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('ports_stack');
}
}

View File

@ -0,0 +1,66 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreatePortsStatisticsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('ports_statistics', function (Blueprint $table) {
$table->unsignedInteger('port_id')->primary();
$table->bigInteger('ifInNUcastPkts')->nullable();
$table->bigInteger('ifInNUcastPkts_prev')->nullable();
$table->bigInteger('ifInNUcastPkts_delta')->nullable();
$table->integer('ifInNUcastPkts_rate')->nullable();
$table->bigInteger('ifOutNUcastPkts')->nullable();
$table->bigInteger('ifOutNUcastPkts_prev')->nullable();
$table->bigInteger('ifOutNUcastPkts_delta')->nullable();
$table->integer('ifOutNUcastPkts_rate')->nullable();
$table->bigInteger('ifInDiscards')->nullable();
$table->bigInteger('ifInDiscards_prev')->nullable();
$table->bigInteger('ifInDiscards_delta')->nullable();
$table->integer('ifInDiscards_rate')->nullable();
$table->bigInteger('ifOutDiscards')->nullable();
$table->bigInteger('ifOutDiscards_prev')->nullable();
$table->bigInteger('ifOutDiscards_delta')->nullable();
$table->integer('ifOutDiscards_rate')->nullable();
$table->bigInteger('ifInUnknownProtos')->nullable();
$table->bigInteger('ifInUnknownProtos_prev')->nullable();
$table->bigInteger('ifInUnknownProtos_delta')->nullable();
$table->integer('ifInUnknownProtos_rate')->nullable();
$table->bigInteger('ifInBroadcastPkts')->nullable();
$table->bigInteger('ifInBroadcastPkts_prev')->nullable();
$table->bigInteger('ifInBroadcastPkts_delta')->nullable();
$table->integer('ifInBroadcastPkts_rate')->nullable();
$table->bigInteger('ifOutBroadcastPkts')->nullable();
$table->bigInteger('ifOutBroadcastPkts_prev')->nullable();
$table->bigInteger('ifOutBroadcastPkts_delta')->nullable();
$table->integer('ifOutBroadcastPkts_rate')->nullable();
$table->bigInteger('ifInMulticastPkts')->nullable();
$table->bigInteger('ifInMulticastPkts_prev')->nullable();
$table->bigInteger('ifInMulticastPkts_delta')->nullable();
$table->integer('ifInMulticastPkts_rate')->nullable();
$table->bigInteger('ifOutMulticastPkts')->nullable();
$table->bigInteger('ifOutMulticastPkts_prev')->nullable();
$table->bigInteger('ifOutMulticastPkts_delta')->nullable();
$table->integer('ifOutMulticastPkts_rate')->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('ports_statistics');
}
}

View File

@ -0,0 +1,42 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreatePortsStpTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('ports_stp', function (Blueprint $table) {
$table->increments('port_stp_id');
$table->unsignedInteger('device_id');
$table->unsignedInteger('port_id');
$table->tinyInteger('priority')->unsigned();
$table->string('state', 11);
$table->string('enable', 8);
$table->integer('pathCost')->unsigned();
$table->string('designatedRoot', 32);
$table->smallInteger('designatedCost')->unsigned();
$table->string('designatedBridge', 32);
$table->mediumInteger('designatedPort');
$table->integer('forwardTransitions')->unsigned();
$table->unique(['device_id','port_id'], 'device_id');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('ports_stp');
}
}

View File

@ -0,0 +1,102 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreatePortsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('ports', function (Blueprint $table) {
$table->increments('port_id');
$table->unsignedInteger('device_id')->default(0);
$table->string('port_descr_type')->nullable();
$table->string('port_descr_descr')->nullable();
$table->string('port_descr_circuit')->nullable();
$table->string('port_descr_speed', 32)->nullable();
$table->string('port_descr_notes')->nullable();
$table->string('ifDescr')->nullable()->index('if_2');
$table->string('ifName')->nullable();
$table->string('portName', 128)->nullable();
$table->bigInteger('ifIndex')->nullable()->default(0);
$table->bigInteger('ifSpeed')->nullable();
$table->string('ifConnectorPresent', 12)->nullable();
$table->string('ifPromiscuousMode', 12)->nullable();
$table->integer('ifHighSpeed')->nullable();
$table->string('ifOperStatus', 16)->nullable();
$table->string('ifOperStatus_prev', 16)->nullable();
$table->string('ifAdminStatus', 16)->nullable();
$table->string('ifAdminStatus_prev', 16)->nullable();
$table->string('ifDuplex', 12)->nullable();
$table->integer('ifMtu')->nullable();
$table->text('ifType', 65535)->nullable();
$table->text('ifAlias', 65535)->nullable();
$table->text('ifPhysAddress', 65535)->nullable();
$table->string('ifHardType', 64)->nullable();
$table->bigInteger('ifLastChange')->unsigned()->default(0);
$table->string('ifVlan', 8)->default('');
$table->string('ifTrunk', 16)->nullable();
$table->integer('ifVrf')->default(0);
$table->integer('counter_in')->nullable();
$table->integer('counter_out')->nullable();
$table->boolean('ignore')->default(0);
$table->boolean('disabled')->default(0);
$table->boolean('detailed')->default(0);
$table->boolean('deleted')->default(0);
$table->string('pagpOperationMode', 32)->nullable();
$table->string('pagpPortState', 16)->nullable();
$table->string('pagpPartnerDeviceId', 48)->nullable();
$table->string('pagpPartnerLearnMethod', 16)->nullable();
$table->integer('pagpPartnerIfIndex')->nullable();
$table->integer('pagpPartnerGroupIfIndex')->nullable();
$table->string('pagpPartnerDeviceName', 128)->nullable();
$table->string('pagpEthcOperationMode', 16)->nullable();
$table->string('pagpDeviceId', 48)->nullable();
$table->integer('pagpGroupIfIndex')->nullable();
$table->unsignedBigInteger('ifInUcastPkts')->nullable();
$table->unsignedBigInteger('ifInUcastPkts_prev')->nullable();
$table->unsignedBigInteger('ifInUcastPkts_delta')->nullable();
$table->unsignedBigInteger('ifInUcastPkts_rate')->nullable();
$table->unsignedBigInteger('ifOutUcastPkts')->nullable();
$table->unsignedBigInteger('ifOutUcastPkts_prev')->nullable();
$table->unsignedBigInteger('ifOutUcastPkts_delta')->nullable();
$table->unsignedBigInteger('ifOutUcastPkts_rate')->nullable();
$table->unsignedBigInteger('ifInErrors')->nullable();
$table->unsignedBigInteger('ifInErrors_prev')->nullable();
$table->unsignedBigInteger('ifInErrors_delta')->nullable();
$table->unsignedBigInteger('ifInErrors_rate')->nullable();
$table->unsignedBigInteger('ifOutErrors')->nullable();
$table->unsignedBigInteger('ifOutErrors_prev')->nullable();
$table->unsignedBigInteger('ifOutErrors_delta')->nullable();
$table->unsignedBigInteger('ifOutErrors_rate')->nullable();
$table->unsignedBigInteger('ifInOctets')->nullable();
$table->unsignedBigInteger('ifInOctets_prev')->nullable();
$table->unsignedBigInteger('ifInOctets_delta')->nullable();
$table->unsignedBigInteger('ifInOctets_rate')->nullable();
$table->unsignedBigInteger('ifOutOctets')->nullable();
$table->unsignedBigInteger('ifOutOctets_prev')->nullable();
$table->unsignedBigInteger('ifOutOctets_delta')->nullable();
$table->unsignedBigInteger('ifOutOctets_rate')->nullable();
$table->unsignedInteger('poll_time')->nullable();
$table->unsignedInteger('poll_prev')->nullable();
$table->unsignedInteger('poll_period')->nullable();
$table->unique(['device_id','ifIndex'], 'device_ifIndex');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('ports');
}
}

View File

@ -0,0 +1,39 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreatePortsVlansTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('ports_vlans', function (Blueprint $table) {
$table->increments('port_vlan_id');
$table->unsignedInteger('device_id');
$table->unsignedInteger('port_id');
$table->integer('vlan');
$table->integer('baseport');
$table->bigInteger('priority');
$table->string('state', 16);
$table->integer('cost');
$table->boolean('untagged')->default(0);
$table->unique(['device_id','port_id','vlan'], 'unique');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('ports_vlans');
}
}

View File

@ -0,0 +1,36 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateProcessesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('processes', function (Blueprint $table) {
$table->unsignedInteger('device_id')->index('device_id');
$table->integer('pid');
$table->integer('vsz');
$table->integer('rss');
$table->string('cputime', 12);
$table->string('user', 50);
$table->text('command');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('processes');
}
}

Some files were not shown because too many files have changed in this diff Show More