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

Settings: Bump DB model to 36

parent 4c76cf89
......@@ -1410,6 +1410,12 @@ InitializeResult MediaLibrary::updateDatabaseModel( unsigned int previousVersion
migrateModel34to35();
previousVersion = 35;
}
if ( previousVersion == 35 )
{
migrateModel35to36();
previousVersion = 36;
needRescan = true;
}
// To be continued in the future!
migrationEpilogue( originalPreviousVersion );
......@@ -2040,6 +2046,16 @@ void MediaLibrary::migrateModel34to35()
t->commit();
}
void MediaLibrary::migrateModel35to36()
{
auto dbConn = getConn();
sqlite::Connection::WeakDbContext weakConnCtx{ dbConn };
auto t = dbConn->newTransaction();
m_settings.setDbModelVersion( 36 );
t->commit();
}
void MediaLibrary::migrationEpilogue( uint32_t )
{
}
......
......@@ -302,6 +302,7 @@ private:
void migrateModel32to33();
void migrateModel33to34();
void migrateModel34to35();
void migrateModel35to36();
/**
* Runs some migration steps that depend on the actual C++ code, and that
* therefor require the migration to have already completed
......
......@@ -32,7 +32,7 @@
namespace medialibrary
{
const uint32_t Settings::DbModelVersion = 35u;
const uint32_t Settings::DbModelVersion = 36u;
const uint32_t Settings::MaxTaskAttempts = 2u;
const uint32_t Settings::MaxLinkTaskAttempts = 6u;
......
......@@ -723,6 +723,11 @@ static void Upgrade34to35( DbModel* T )
T->CommonMigrationTest( SRC_DIR "/test/unittest/db_v34.sql" );
}
static void Upgrade35to36( DbModel* T )
{
T->CommonMigrationTest( SRC_DIR "/test/unittest/db_v35.sql" );
}
int main( int ac, char** av )
{
INIT_TESTS_C( DbModel )
......@@ -749,6 +754,7 @@ int main( int ac, char** av )
ADD_TEST( Upgrade32to33 );
ADD_TEST( Upgrade33to34 );
ADD_TEST( Upgrade34to35 );
ADD_TEST( Upgrade35to36 );
END_TESTS
}
This diff is collapsed.
......@@ -201,6 +201,7 @@ db_model_tests = [
'Upgrade32to33',
'Upgrade33to34',
'Upgrade34to35',
'Upgrade35to36',
]
foreach t : db_model_tests
......
Supports Markdown
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