Commit 7f79dbab authored by Hugo Beauzée-Luyssen's avatar Hugo Beauzée-Luyssen
Browse files

MediaLibrary: Bump model to version 9

This is only a rescan, due to changes in album detection and MRL
encoding
parent 30daa980
...@@ -799,6 +799,18 @@ InitializeResult MediaLibrary::updateDatabaseModel( unsigned int previousVersion ...@@ -799,6 +799,18 @@ InitializeResult MediaLibrary::updateDatabaseModel( unsigned int previousVersion
migrateModel7to8(); migrateModel7to8();
previousVersion = 8; previousVersion = 8;
} }
if ( previousVersion == 8 )
{
// Multiple changes justify the rescan:
// - Changes in the way we chose to encode or not MRL, meaning
// potentially all MRL are wrong (more precisely, will
// mismatch what VLC expects, which makes playlist analysis
// break.
// - Fix in the way we chose album candidates, meaning some
// albums were likely to be wrongfully created.
forceRescan();
previousVersion = 9;
}
// To be continued in the future! // To be continued in the future!
// Safety check: ensure we didn't forget a migration along the way // Safety check: ensure we didn't forget a migration along the way
......
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
namespace medialibrary namespace medialibrary
{ {
const uint32_t Settings::DbModelVersion = 8u; const uint32_t Settings::DbModelVersion = 9u;
Settings::Settings( MediaLibrary* ml ) Settings::Settings( MediaLibrary* ml )
: m_ml( ml ) : m_ml( ml )
......
...@@ -138,8 +138,6 @@ TEST_F( DbModel, Upgrade7to8 ) ...@@ -138,8 +138,6 @@ TEST_F( DbModel, Upgrade7to8 )
LoadFakeDB( SRC_DIR "/test/unittest/db_v7.sql" ); LoadFakeDB( SRC_DIR "/test/unittest/db_v7.sql" );
auto res = ml->initialize( "test.db", "/tmp", cbMock.get() ); auto res = ml->initialize( "test.db", "/tmp", cbMock.get() );
ASSERT_EQ( InitializeResult::Success, res ); ASSERT_EQ( InitializeResult::Success, res );
// V8 adds Artist::nb_tracks and should compute the values automatically // Removed post migration tests starting with V9, since we force a re-scan,
auto a = std::static_pointer_cast<Artist>( ml->artist( 3 ) ); // there is no content left to test
ASSERT_NE( nullptr, a );
ASSERT_EQ( 5u, a->nbTracks() );
} }
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment