mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Faster initial database creation (#12297)
* Faster initial database creation Add db dumps to improve initial db migration On my test system 13s -> 7s, a 46% reduction. Should help out a lot on systems like RPi * lnms schema:dump command --snapshots saves db snapshots, otherwise it saves the yaml * fix style * fix timezones... * not working with in-memory db yet remove build.sql
This commit is contained in:
@@ -26,6 +26,7 @@ namespace LibreNMS\Tests;
|
||||
|
||||
use Artisan;
|
||||
use DB;
|
||||
use LibreNMS\DB\Schema;
|
||||
|
||||
class DBSetupTest extends DBTestCase
|
||||
{
|
||||
@@ -118,10 +119,10 @@ class DBSetupTest extends DBTestCase
|
||||
file_get_contents('misc/db_schema.yaml')
|
||||
);
|
||||
|
||||
$current_schema = dump_db_schema($this->connection);
|
||||
$current_schema = Schema::dump($this->connection);
|
||||
|
||||
$message = "Schema does not match the expected schema defined by misc/db_schema.yaml\n";
|
||||
$message .= "If you have changed the schema, make sure you update it with ./scripts/build-schema.php\n";
|
||||
$message .= "If you have changed the schema, make sure you update it with: lnms schema:dump\n";
|
||||
|
||||
$this->assertEquals($master_schema, $current_schema, $message);
|
||||
}
|
||||
|
Reference in New Issue
Block a user