Hello,
there is a manual procedure to upgrade to a new major version.
From https://docs.librenms.org/General/Updating/ -> avanced user, I do after
git pull
git reset --hard <major-version>
composer install --no-dev
./build-base.php
./validate.php
major-version : for example 1.58
If I want to downgrade to a previous version. I can do :
git reset --hard <previous-major-version>
composer install --no-dev
./build-base.php
./validate.php
previous-major-version : for example 1.57
If there is no database migration between 1.57 and 1.58, it will work. But if not, it won’t.
Code contains routines to migrate database schema (function up) and to revert (function down). But how to do the migration revert easily ?
$ cat database/migrations/2019_10_03_211702_serialize_config.php
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class SerializeConfig extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
(...)
DB::table('config')
->where('config_id', $config->config_id)
->update(['config_value' => json_encode($value)]);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
DB::table('config')->get()->each(function ($config) {
$value = json_decode($config->config_value);
$value = is_bool($value) ? var_export($value, true) : (string)$value;
DB::table('config')
->where('config_id', $config->config_id)
->update(['config_value' => $value]);
});
}
}