Adds support for influxdb version 1

This commit is contained in:
Henry Whitaker
2021-04-10 21:57:31 +01:00
parent 76e21bfe9d
commit 5db1106c37
13 changed files with 512 additions and 2 deletions

View File

@@ -0,0 +1,74 @@
<?php
use App\Helpers\SettingsHelper;
use App\Setting;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddInfluxDbSettings extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
if (!SettingsHelper::get('influx_db_enabled')) {
Setting::create([
'name' => 'influx_db_enabled',
'value' => false,
'description' => 'Enable the InfluxDB integration for speedtests.'
]);
}
if (!SettingsHelper::get('influx_db_host')) {
Setting::create([
'name' => 'influx_db_host',
'value' => '',
'description' => 'InfluxDB hostname, include the protocol (http:// or https://).'
]);
}
if (!SettingsHelper::get('influx_db_port')) {
Setting::create([
'name' => 'influx_db_port',
'value' => '',
'description' => 'InfluxDB port'
]);
}
if (!SettingsHelper::get('influx_db_database')) {
Setting::create([
'name' => 'influx_db_database',
'value' => '',
'description' => 'InfluxDB database'
]);
}
if (!SettingsHelper::get('influx_db_version')) {
Setting::create([
'name' => 'influx_db_version',
'value' => 1,
'description' => 'InfluxDB version'
]);
}
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Setting::whereIn('name', [
'influx_db_enabled',
'influx_db_host',
'influx_db_port',
'influx_db_database',
'influx_db_version',
])->delete();
}
}