First Upload

This commit is contained in:
2024-10-19 18:23:55 +00:00
commit 9db52c11c3
11339 changed files with 1479286 additions and 0 deletions

View File

@@ -0,0 +1,45 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateActivityLogTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('activity_log', function (Blueprint $table) {
$table->increments('id');
$table->string('log_name')->nullable()->index();
$table->text('description', 65535);
$table->integer('subject_id')->nullable();
$table->string('subject_type')->nullable();
$table->integer('causer_id')->nullable();
$table->string('causer_type')->nullable();
$table->text('properties', 65535)->nullable();
$table->string('event_type')->nullable();
$table->string('device_name')->nullable();
$table->string('device_id')->nullable();
$table->string('events_ids')->nullable();
$table->string('connection_category')->nullable();
$table->text('connection_ids', 65535)->nullable();
$table->text('class', 65535)->nullable();
$table->text('function', 65535)->nullable();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('activity_log');
}
}

View File

@@ -0,0 +1,61 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateCategoriesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('categories', function (Blueprint $table) {
$table->increments('id');
$table->string('categoryName', 191)->unique('categoryName');
$table->text('categoryDescription', 65535)->nullable();
$table->string('badgeColor', 50)->nullable();
$table->dateTime('created_at')->nullable();
$table->string('updated_at', 50)->nullable();
});
DB::table('categories')->insert([
0 => [
'id' => '1',
'categoryName' => 'Routers',
'categoryDescription' => null,
'badgeColor' => 'badge-primary',
'created_at' => '2018-06-06 22:20:44',
'updated_at' => null,
],
1 => [
'id' => '2',
'categoryName' => 'Switches',
'categoryDescription' => null,
'badgeColor' => 'bg-danger',
'created_at' => '2018-06-06 22:20:52',
'updated_at' => null,
],
2 => [
'id' => '3',
'categoryName' => 'Firewalls',
'categoryDescription' => null,
'badgeColor' => 'badge-warning',
'created_at' => '2018-06-06 21:21:04',
'updated_at' => null,
],
]);
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('categories');
}
}

View File

@@ -0,0 +1,45 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateCategoryCommandTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('category_command', function (Blueprint $table) {
$table->integer('category_id')->nullable();
$table->integer('command_id')->nullable();
});
DB::table('category_command')->insert([
0 => [
'category_id' => '1',
'command_id' => '1',
],
1 => [
'category_id' => '1',
'command_id' => '2',
],
2 => [
'category_id' => '1',
'command_id' => '3',
],
]);
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('category_command');
}
}

View File

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

View File

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

View File

@@ -0,0 +1,57 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateCommandsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('commands', function (Blueprint $table) {
$table->integer('id', true);
$table->string('command', 255);
$table->string('description')->nullable();
$table->timestamps();
});
DB::table('commands')->insert([
0 => [
'id' => '1',
'command' => 'show clock',
'description' => 'An Example command',
'created_at' => '2019-07-16 05:51:44',
'updated_at' => '2019-07-16 05:51:44',
],
1 => [
'id' => '2',
'command' => 'show version',
'description' => 'An Example command',
'created_at' => '2019-07-16 05:51:44',
'updated_at' => '2019-07-16 05:51:44',
],
2 => [
'id' => '3',
'command' => 'show run',
'description' => 'An Example command',
'created_at' => '2019-07-16 05:51:44',
'updated_at' => '2019-07-16 05:51:44',
],
]);
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('commands');
}
}

View File

@@ -0,0 +1,44 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateConfigsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('configs', function (Blueprint $table) {
$table->integer('id', true);
$table->integer('device_id')->nullable();
$table->string('device_name')->nullable();
$table->string('device_category')->nullable();
$table->string('command')->nullable();
$table->string('type')->nullable();
$table->integer('download_status')->nullable();
$table->string('report_id')->nullable();
$table->string('config_location')->nullable();
$table->string('config_filename')->nullable();
$table->dateTime('start_time')->nullable();
$table->dateTime('end_time')->nullable();
$table->integer('duration')->nullable();
$table->dateTime('created_at')->nullable();
$table->dateTime('updated_at')->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('configs');
}
}

View File

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

View File

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

View File

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

View File

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

View File

@@ -0,0 +1,45 @@
<?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->integer('id', true);
$table->string('device_name', 191)->nullable();
$table->string('device_ip', 191)->nullable();
$table->integer('device_default_creds_on')->nullable();
$table->string('device_username', 191)->nullable();
$table->string('device_password')->nullable();
$table->string('device_enable_password')->nullable();
$table->string('device_main_prompt')->nullable();
$table->string('device_enable_prompt', 191)->nullable();
$table->integer('device_category_id')->nullable();
$table->integer('device_template')->nullable();
$table->string('device_model', 191)->nullable();
$table->string('device_version', 191)->nullable();
$table->string('device_added_by', 191)->nullable()->default('-');
$table->timestamps();
$table->integer('status')->nullable()->default(1);
$table->timestamp('last_seen')->nullable();
});
}
/**
* 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;
use Illuminate\Support\Facades\Schema;
class CreateFailedJobsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('failed_jobs', function (Blueprint $table) {
$table->id();
$table->string('uuid')->unique();
$table->text('connection');
$table->text('queue');
$table->longText('payload');
$table->longText('exception');
$table->timestamp('failed_at')->useCurrent();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('failed_jobs');
}
}

View File

@@ -0,0 +1,35 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateJobsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('jobs', function (Blueprint $table) {
$table->bigInteger('id', true)->unsigned();
$table->string('queue')->index();
$table->text('payload', 65535);
$table->boolean('attempts');
$table->integer('reserved_at')->unsigned()->nullable();
$table->integer('available_at')->unsigned();
$table->integer('created_at')->unsigned();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('jobs');
}
}

View File

@@ -0,0 +1,32 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
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,70 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateSettingsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('settings', function (Blueprint $table) {
$table->integer('id', true);
$table->text('login_banner', 65535)->nullable();
$table->string('timezone')->nullable();
$table->string('mail_host')->nullable();
$table->integer('mail_port')->nullable();
$table->string('mail_from_email')->nullable();
$table->text('mail_to_email', 65535)->nullable();
$table->integer('mail_authcheck')->nullable();
$table->string('mail_username')->nullable();
$table->string('mail_password', 512)->nullable();
$table->string('mail_driver')->nullable();
$table->string('mail_encryption')->nullable();
$table->string('defaultDeviceUsername')->nullable();
$table->string('defaultDevicePassword')->nullable();
$table->string('defaultEnablePassword', 512)->nullable();
$table->integer('passwordEncryption')->nullable()->default(0)->comment('0 - no encryption, 1 = encryption');
$table->integer('deviceDebugging')->nullable();
$table->integer('phpDebugging')->nullable();
$table->timestamps();
});
DB::table('settings')->insert([
'id' => '1',
'login_banner' => 'Authorization message - You must be an authorized user to login and use this system.',
'timezone' => 'Europe/Dublin',
'mail_host' => 'devmailer.rconfig.com',
'mail_port' => 1025,
'mail_from_email' => 'admin@domain.com',
'mail_to_email' => 'user@domain.com',
'mail_authcheck' => '0',
'mail_username' => null,
'mail_password' => null,
'mail_driver' => 'smtp',
'mail_encryption' => null,
'defaultDeviceUsername' => null,
'defaultDevicePassword' => null,
'defaultEnablePassword' => null,
'passwordEncryption' => '1',
'deviceDebugging' => '0',
'phpDebugging' => '1',
'created_at' => '2019-07-15 18:38:03',
'updated_at' => '2019-07-15 18:38:23',
]);
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('settings');
}
}

View File

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

View File

@@ -0,0 +1,50 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateTagsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('tags', function (Blueprint $table) {
$table->integer('id', true);
$table->string('tagname', 50);
$table->string('tagDescription')->nullable();
$table->timestamps();
});
DB::table('tags')->insert([
0 => [
'id' => '1',
'tagname' => 'Routers',
'tagDescription' => 'A Tag for Routers',
'created_at' => '2019-07-16 05:51:44',
'updated_at' => '2019-07-16 05:51:44',
],
1 => [
'id' => '2',
'tagname' => 'Switches',
'tagDescription' => 'A Tag for Switches',
'created_at' => '2019-07-16 05:51:44',
'updated_at' => '2019-07-16 05:51:44',
],
]);
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('tags');
}
}

View File

@@ -0,0 +1,40 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateTaskdownloadreportsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('taskdownloadreports', function (Blueprint $table) {
$table->integer('id', true);
$table->string('report_id', 50)->nullable();
$table->integer('task_id');
$table->string('task_name')->nullable();
$table->string('task_desc')->nullable();
$table->string('task_type')->default('');
$table->string('file_name')->nullable();
$table->timestamp('start_time')->nullable();
$table->timestamp('end_time')->nullable();
$table->bigInteger('duration')->nullable();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('taskdownloadreports');
}
}

View File

@@ -0,0 +1,42 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateTasksTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('tasks', function (Blueprint $table) {
$table->integer('id', true);
$table->string('task_name')->nullable();
$table->string('task_desc')->nullable();
$table->string('task_command')->nullable();
$table->integer('task_categories')->nullable();
$table->integer('task_devices')->nullable();
$table->integer('task_tags')->nullable();
$table->integer('task_snippet')->nullable();
$table->string('task_cron')->nullable();
$table->integer('task_email_notify')->nullable();
$table->integer('download_report_notify')->nullable();
$table->integer('verbose_download_report_notify')->nullable();
$table->integer('is_system')->nullable()->default(0);
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('tasks');
}
}

View File

@@ -0,0 +1,69 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateTemplatesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('templates', function (Blueprint $table) {
$table->integer('id', true);
$table->string('fileName', 191)->nullable();
$table->string('templateName', 191)->nullable();
$table->string('description', 191)->nullable();
$table->timestamps();
});
DB::table('templates')->insert([
0 => [
'id' => '1',
'fileName' => '/app/rconfig/templates/ios-telnet-noenable.yml',
'templateName' => 'Cisco IOS - TELNET - No Enable',
'description' => 'Cisco IOS TELNET based connection without enable mode',
'created_at' => '2018-02-27 12:09:44',
'updated_at' => null,
],
1 => [
'id' => '2',
'fileName' => '/app/rconfig/templates/ios-telnet-enable.yml',
'templateName' => 'Cisco IOS - TELNET - Enable',
'description' => 'Cisco IOS TELNET based connection with enable mode',
'created_at' => '2018-02-27 12:09:44',
'updated_at' => null,
],
2 => [
'id' => '3',
'fileName' => '/app/rconfig/templates/ios-ssh-noenable.yml',
'templateName' => 'Cisco IOS - SSH - No Enable',
'description' => 'Cisco IOS SSH based connection without enable mode',
'created_at' => '2018-02-27 12:09:44',
'updated_at' => null,
],
3 => [
'id' => '4',
'fileName' => '/app/rconfig/templates/ios-ssh-enable.yml',
'templateName' => 'Cisco IOS - SSH - Enable',
'description' => 'Cisco IOS SSH based connection with enable mode',
'created_at' => '2018-02-27 12:09:44',
'updated_at' => null,
],
]);
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('templates');
}
}

View File

@@ -0,0 +1,53 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateUsersTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('users', function (Blueprint $table) {
$table->increments('id');
$table->string('name');
$table->string('email')->unique();
$table->dateTime('email_verified_at')->nullable();
$table->string('password');
$table->string('remember_token', 100)->nullable();
$table->string('role', 50)->nullable()->comment('0 = user, 1 = admin');
$table->timestamps();
$table->text('settings', 65535)->nullable();
});
DB::table('users')->insert([
0 => [
'id' => '1',
'name' => 'admin',
'email' => 'admin@domain.com',
'email_verified_at' => null,
'password' => '$2y$10$ZF3AXzM/N/xduWF0CQiswOaHYh6EwiNcWJ8AUp.7xv0qDcfLvVsGi',
'remember_token' => null,
'role' => 'Admin',
'created_at' => '2019-07-15 14:25:26',
'updated_at' => '2019-07-15 14:25:26',
'settings' => '{"devices_view":"display1"}',
],
]);
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('users');
}
}

View File

@@ -0,0 +1,69 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateVendorsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('vendors', function (Blueprint $table) {
$table->increments('id');
$table->string('vendorName', 191);
$table->timestamps();
});
DB::table('vendors')->insert([
0 => [
'vendorName' => 'Aruba',
'created_at' => '2018-06-07 13:42:08',
'updated_at' => '2018-06-07 13:42:08',
],
1 => [
'vendorName' => 'Brocade',
'created_at' => '2018-06-07 13:42:08',
'updated_at' => '2018-06-07 13:42:08',
],
2 => [
'vendorName' => 'Checkpoint',
'created_at' => '2018-06-07 13:42:08',
'updated_at' => '2018-06-07 13:42:08',
],
3 => [
'vendorName' => 'Cisco',
'created_at' => '2018-06-07 13:42:08',
'updated_at' => '2018-06-07 13:42:08',
],
4 => [
'vendorName' => 'Dell',
'created_at' => '2018-06-07 13:42:08',
'updated_at' => '2018-06-07 13:42:08',
],
5 => [
'vendorName' => 'Extreme',
'created_at' => '2018-06-07 13:42:08',
'updated_at' => '2018-06-07 13:42:08',
],
6 => [
'vendorName' => 'Fortinet',
'created_at' => '2018-06-07 13:42:08',
'updated_at' => '2018-06-07 13:42:08',
],
]);
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('vendors');
}
}

View File

@@ -0,0 +1,36 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreatePersonalAccessTokensTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('personal_access_tokens', function (Blueprint $table) {
$table->id();
$table->morphs('tokenable');
$table->string('name');
$table->string('token', 64)->unique();
$table->text('abilities')->nullable();
$table->timestamp('last_used_at')->nullable();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('personal_access_tokens');
}
}

View File

@@ -0,0 +1,35 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateNotificationsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('notifications', function (Blueprint $table) {
$table->uuid('id')->primary();
$table->string('type');
$table->morphs('notifiable');
$table->text('data');
$table->timestamp('read_at')->nullable();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('notifications');
}
}

View File

@@ -0,0 +1,35 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateSessionsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('sessions', function (Blueprint $table) {
$table->string('id')->unique();
$table->unsignedBigInteger('user_id')->nullable();
$table->string('ip_address', 45)->nullable();
$table->text('user_agent')->nullable();
$table->text('payload');
$table->integer('last_activity');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('sessions');
}
}

View File

@@ -0,0 +1,33 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class ChangeDevicesPasswordsFieldTypesToText extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('devices', function (Blueprint $table) {
$table->text('device_password')->nullable()->change();
$table->text('device_enable_password')->nullable()->change();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('devices', function (Blueprint $table) {
//
});
}
}

View File

@@ -0,0 +1,32 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddLastLoginFieldToUsersTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('users', function (Blueprint $table) {
$table->timestamp('last_login')->nullable()->after('role');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('users', function (Blueprint $table) {
$table->dropColumn('last_login');
});
}
}

View File

@@ -0,0 +1,32 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class UpdateRoleFieldDefaultValue extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('users', function (Blueprint $table) {
$table->string('role')->default('Admin')->comment(null)->change();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('users', function (Blueprint $table) {
$table->string('role')->default('Admin')->change();
});
}
}

View File

@@ -0,0 +1,49 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateActivityLogArchivesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('activity_log_archives', function (Blueprint $table) {
$table->increments('id');
$table->integer('original_id')->unsigned()->index();
$table->string('log_name')->nullable()->index();
$table->text('description', 65535);
$table->integer('subject_id')->nullable();
$table->string('subject_type')->nullable();
$table->integer('causer_id')->nullable();
$table->string('causer_type')->nullable();
$table->text('properties', 65535)->nullable();
$table->string('event_type')->nullable();
$table->string('device_name')->nullable();
$table->string('device_id')->nullable();
$table->string('events_ids')->nullable();
$table->string('connection_category')->nullable();
$table->text('connection_ids', 65535)->nullable();
$table->text('class', 65535)->nullable();
$table->text('function', 65535)->nullable();
$table->timestamp('original_created_at')->nullable();
$table->timestamp('original_updated_at')->nullable();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('activity_log_archives');
}
}

View File

@@ -0,0 +1,32 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddFilesizeToConfigs extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('configs', function (Blueprint $table) {
$table->bigInteger('config_filesize')->after('config_filename')->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('configs', function (Blueprint $table) {
$table->dropColumn('config_filesize');
});
}
}

View File

@@ -0,0 +1,39 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateJobBatchesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('job_batches', function (Blueprint $table) {
$table->string('id')->primary();
$table->string('name');
$table->integer('total_jobs');
$table->integer('pending_jobs');
$table->integer('failed_jobs');
$table->text('failed_job_ids');
$table->text('options')->nullable();
$table->integer('cancelled_at')->nullable();
$table->integer('created_at');
$table->integer('finished_at')->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('job_batches');
}
}

View File

@@ -0,0 +1,32 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddSshKeyFieldToDevicesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('devices', function (Blueprint $table) {
$table->string('ssh_key_id')->nullable()->after('device_enable_password');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('devices', function (Blueprint $table) {
$table->dropColumn('ssh_key_id');
});
}
}

View File

@@ -0,0 +1,34 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class UpdateDefaultPasswordsFieldType extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('settings', function (Blueprint $table) {
$table->text('defaultDevicePassword')->change();
$table->text('defaultEnablePassword')->change();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('settings', function (Blueprint $table) {
$table->string('defaultDevicePassword')->change();
$table->string('defaultEnablePassword')->change();
});
}
}

View File

@@ -0,0 +1,32 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class UpdateMailPasswordFieldType extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('settings', function (Blueprint $table) {
$table->text('mail_password')->change();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('settings', function (Blueprint $table) {
$table->string('mail_password')->change();
});
}
}

View File

@@ -0,0 +1,40 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
use Spatie\Health\ResultStores\EloquentHealthResultStore;
return new class extends Migration
{
public function up()
{
$tableName = EloquentHealthResultStore::getHistoryItemInstance()->getTable();
Schema::create($tableName, function (Blueprint $table) {
$table->id();
$table->string('check_name');
$table->string('check_label');
$table->string('status');
$table->text('notification_message')->nullable();
$table->string('short_summary')->nullable();
$table->json('meta');
$table->timestamp('ended_at');
$table->uuid('batch');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
$tableName = EloquentHealthResultStore::getHistoryItemInstance()->getTable();
Schema::dropIfExists($tableName);
}
};

View File

@@ -0,0 +1,38 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddBatchUuidColumnToActivityLogTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('activity_log', function (Blueprint $table) {
$table->uuid('batch_uuid')->nullable()->after('properties');
});
Schema::table('activity_log_archives', function (Blueprint $table) {
$table->uuid('batch_uuid')->nullable()->after('properties');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('activity_log', function (Blueprint $table) {
$table->dropColumn('batch_uuid');
});
Schema::table('activity_log_archives', function (Blueprint $table) {
$table->dropColumn('batch_uuid');
});
}
}

View File

@@ -0,0 +1,32 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class ChangeSettingsMailHostDefaultValue extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('settings', function (Blueprint $table) {
$table->string('mail_host')->default('default')->change();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('settings', function (Blueprint $table) {
$table->string('mail_host')->nullable()->change();
});
}
}

View File

@@ -0,0 +1,32 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddIndexesToConfigsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('configs', function (Blueprint $table) {
$table->index(['device_id', 'device_name', 'command', 'report_id']);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('configs', function (Blueprint $table) {
$table->dropIndex(['device_id', 'device_name', 'command', 'report_id']);
});
}
}

View File

@@ -0,0 +1,32 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddIndexesToDevicesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('devices', function (Blueprint $table) {
$table->index(['device_name']);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('devices', function (Blueprint $table) {
$table->dropIndex(['device_name']);
});
}
}

View File

@@ -0,0 +1,32 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddDeviceCredIdFieldToDevicesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('devices', function (Blueprint $table) {
$table->integer('device_cred_id')->after('device_default_creds_on')->nullable()->default(0);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('devices', function (Blueprint $table) {
$table->dropColumn('device_cred_id');
});
}
}

View File

@@ -0,0 +1,47 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateScheduleMonitorTables extends Migration
{
public function up()
{
Schema::create('monitored_scheduled_tasks', function (Blueprint $table) {
$table->bigIncrements('id');
$table->integer('task_id');
$table->string('name');
$table->string('type')->nullable();
$table->string('cron_expression');
$table->string('timezone')->nullable();
$table->string('ping_url')->nullable();
$table->dateTime('last_started_at')->nullable();
$table->dateTime('last_finished_at')->nullable();
$table->dateTime('last_failed_at')->nullable();
$table->dateTime('last_skipped_at')->nullable();
$table->timestamps();
});
Schema::create('monitored_scheduled_task_log_items', function (Blueprint $table) {
$table->bigIncrements('id');
$table->integer('task_id');
$table->unsignedBigInteger('monitored_scheduled_task_id');
$table
->foreign('monitored_scheduled_task_id', 'fk_scheduled_task_id')
->references('id')
->on('monitored_scheduled_tasks')
->cascadeOnDelete();
$table->string('type');
$table->json('meta')->nullable();
$table->timestamps();
});
}
}

View File

@@ -0,0 +1,31 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateTrackedJobsTable extends Migration
{
public function up()
{
Schema::create('tracked_jobs', function (Blueprint $table) {
$table->bigIncrements('id');
$table->string('trackable_id')->index();
$table->string('trackable_type')->index();
$table->string('queue')->nullable();
$table->string('status')->default('queued');
$table->longText('payload')->nullable();
$table->longText('command')->nullable();
$table->integer('device_id')->nullable();
$table->longText('output')->nullable();
$table->timestamp('started_at')->nullable();
$table->timestamp('finished_at')->nullable();
$table->timestamps();
});
}
public function down()
{
Schema::dropIfExists('tracked_jobs');
}
}

View File

@@ -0,0 +1,32 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddUsernameFieldToUsersTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('users', function (Blueprint $table) {
$table->string('username')->after('name')->nullable()->default(null);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('devices', function (Blueprint $table) {
$table->dropColumn('username');
});
}
}

View File

@@ -0,0 +1,32 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('monitored_scheduled_task_log_items', function (Blueprint $table) {
$table->string('meta', 255)->nullable()->change();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('monitored_scheduled_task_log_items', function (Blueprint $table) {
$table->json('meta')->nullable();
});
}
};

View File

@@ -0,0 +1,28 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('devices', function (Blueprint $table) {
$table->string('device_port_override')->nullable()->after('device_ip');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('devices', function (Blueprint $table) {
$table->dropColumn('device_port_override');
});
}
};