mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
new index in alert_log table (#12143)
* new index in alert_log table * codefix1 * codefix2 * added second index * codefix * Apply suggestions from code review Co-authored-by: Jellyfrog <Jellyfrog@users.noreply.github.com>
This commit is contained in:
@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddAlertLogIndex extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('alert_log', function (Blueprint $table) {
|
||||
$table->index(['rule_id', 'device_id']);
|
||||
$table->index(['rule_id', 'device_id', 'state']);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('alert_log', function (Blueprint $table) {
|
||||
$table->dropIndex(['rule_id', 'device_id']);
|
||||
$table->dropIndex(['rule_id', 'device_id', 'state']);
|
||||
});
|
||||
}
|
||||
}
|
@ -72,6 +72,8 @@ alert_log:
|
||||
alert_log_device_id_index: { Name: alert_log_device_id_index, Columns: [device_id], Unique: false, Type: BTREE }
|
||||
alert_log_rule_id_index: { Name: alert_log_rule_id_index, Columns: [rule_id], Unique: false, Type: BTREE }
|
||||
alert_log_time_logged_index: { Name: alert_log_time_logged_index, Columns: [time_logged], Unique: false, Type: BTREE }
|
||||
alert_log_rule_id_device_id_index: { Name: alert_log_rule_id_device_id_index, Columns: [rule_id, device_id], Unique: false, Type: BTREE }
|
||||
alert_log_rule_id_device_id_state_index: { Name: alert_log_rule_id_device_id_state_index, Columns: [rule_id, device_id, state], Unique: false, Type: BTREE }
|
||||
alert_rules:
|
||||
Columns:
|
||||
- { Field: id, Type: 'int unsigned', 'Null': false, Extra: auto_increment }
|
||||
|
Reference in New Issue
Block a user