mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
service templates - jellyfrog fixes - dbchanged - DeviceGroup relates to Service Template
This commit is contained in:
@@ -33,6 +33,23 @@ class CreateServicesTemplateTable extends Migration
|
||||
$table->string('service_name')->nullable()->default(null);
|
||||
$table->unsignedInteger('service_template_changed')->default(0);
|
||||
});
|
||||
Schema::create('service_templates_perms', function (Blueprint $table) {
|
||||
$table->id->first()();
|
||||
$table->unsignedInteger('user_id')->index();
|
||||
$table->unsignedInteger('service_template_id');
|
||||
});
|
||||
Schema::table('device_group_service_template', function (Blueprint $table) {
|
||||
$table->foreign('device_group_id')->references('id')->on('device_groups')->onUpdate('RESTRICT')->onDelete('CASCADE');
|
||||
$table->foreign('service_template_id')->references('id')->on('service_templates')->onUpdate('RESTRICT')->onDelete('CASCADE');
|
||||
});
|
||||
Schema::create('device_group_service_template', function (Blueprint $table) {
|
||||
$table->unsignedInteger('device_group_id')->unsigned()->index();
|
||||
$table->unsignedInteger('service_template_id')->unsigned()->index();
|
||||
$table->primary(['device_group_id', 'service_template_id']);
|
||||
});
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -50,5 +67,15 @@ class CreateServicesTemplateTable extends Migration
|
||||
'service_template_changed',
|
||||
]);
|
||||
});
|
||||
Schema::drop('devices_perms');
|
||||
if (\LibreNMS\DB\Eloquent::getDriver() !== 'sqlite') {
|
||||
Schema::table('device_group_service_template', function (Blueprint $table) {
|
||||
$table->dropForeign('device_group_service_template_device_group_id_foreign');
|
||||
$table->dropForeign('device_group_service_template_service_template_id_foreign');
|
||||
});
|
||||
}
|
||||
Schema::drop('device_group_device');
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -604,6 +604,17 @@ device_group_device:
|
||||
Constraints:
|
||||
device_group_device_device_group_id_foreign: { name: device_group_device_device_group_id_foreign, foreign_key: device_group_id, table: device_groups, key: id, extra: 'ON DELETE CASCADE' }
|
||||
device_group_device_device_id_foreign: { name: device_group_device_device_id_foreign, foreign_key: device_id, table: devices, key: device_id, extra: 'ON DELETE CASCADE' }
|
||||
device_group_service_template:
|
||||
Columns:
|
||||
- { Field: device_group_id, Type: 'int unsigned', 'Null': false, Extra: '' }
|
||||
- { Field: service_template_id, Type: 'int unsigned', 'Null': false, Extra: '' }
|
||||
Indexes:
|
||||
PRIMARY: { Name: PRIMARY, Columns: [device_group_id, service_template_id], Unique: true, Type: BTREE }
|
||||
device_group_service_template_device_group_id_index: { Name: device_group_service_template_device_group_id_index, Columns: [device_group_id], Unique: false, Type: BTREE }
|
||||
device_group_service_template_service_template_id_index: { Name: device_group_service_template_service_template_id_index, Columns: [service_template_id], Unique: false, Type: BTREE }
|
||||
Constraints:
|
||||
device_group_service_template_device_group_id_foreign: { name: device_group_service_template_device_group_id_foreign, foreign_key: device_group_id, table: device_groups, key: id, extra: 'ON DELETE CASCADE' }
|
||||
device_group_service_template_service_template_id_foreign: { name: device_group_service_template_service_template_id_foreign, foreign_key: service_template_id, table: devices, key: service_template_id, extra: 'ON DELETE CASCADE' }
|
||||
device_outages:
|
||||
Columns:
|
||||
- { Field: device_id, Type: 'int unsigned', 'Null': false, Extra: '' }
|
||||
@@ -1777,6 +1788,14 @@ service_templates:
|
||||
Indexes:
|
||||
PRIMARY: { Name: PRIMARY, Columns: [id], Unique: true, Type: BTREE }
|
||||
service_templates_device_group_id_index: { Name: service_templates_device_group_id_index, Columns: [device_group_id], Unique: false, Type: BTREE }
|
||||
service_templates_perms:
|
||||
Columns:
|
||||
- { Field: user_id, Type: 'int unsigned', 'Null': false, Extra: '' }
|
||||
- { Field: service_template_id, Type: 'int unsigned', 'Null': false, Extra: '' }
|
||||
Indexes:
|
||||
PRIMARY: { Name: PRIMARY, Columns: [service_template_id, user_id], Unique: true, Type: BTREE }
|
||||
service_templates_perms_service_template_id_index: { Name: service_templates_perms_service_template_id_index, Columns: [service_template_id], Unique: false, Type: BTREE }
|
||||
service_templates_perms_user_id_index: { Name: service_templates_perms_user_id_index, Columns: [user_id], Unique: false, Type: BTREE }
|
||||
session:
|
||||
Columns:
|
||||
- { Field: session_id, Type: 'int unsigned', 'Null': false, Extra: auto_increment }
|
||||
|
||||
Reference in New Issue
Block a user