Incremented the database version so that next rescan will force rescan to detect missing WMA covers

This commit is contained in:
emeric
2019-10-26 15:37:59 +02:00
parent 55d9220ae4
commit a1e06282d6
3 changed files with 14 additions and 2 deletions
+6
View File
@@ -130,5 +130,11 @@ ScanSettings::setClusterTypes(Session& session, const std::set<std::string>& clu
_scanVersion += 1;
}
void
ScanSettings::incScanVersion()
{
_scanVersion += 1;
}
} // namespace Database
+1 -1
View File
@@ -58,7 +58,7 @@ class ScanSettings : public Wt::Dbo::Dbo<ScanSettings>
void setUpdateStartTime(Wt::WTime t) { _startTime = t; }
void setUpdatePeriod(UpdatePeriod p) { _updatePeriod = p; }
void setClusterTypes(Session& session, const std::set<std::string>& clusterTypeNames);
void setAudioFileExtensions(std::set<std::filesystem::path> fileExtensions);
void incScanVersion();
template<class Action>
void persist(Action& a)
+7 -1
View File
@@ -35,7 +35,7 @@
namespace Database {
#define LMS_DATABASE_VERSION 6
#define LMS_DATABASE_VERSION 7
using Version = std::size_t;
@@ -102,6 +102,12 @@ Session::doDatabaseMigrationIfNeeded()
LMS_LOG(DB, INFO) << "Migrating database from version 5...";
_session.execute("DELETE FROM auth_token"); // format has changed
break;
case 6:
LMS_LOG(DB, INFO) << "Migrating database from version 6...";
// Just increment the scan version of the settings to make the next scheduled scan rescan everything
ScanSettings::get(*this).modify()->incScanVersion();
break;
default:
LMS_LOG(DB, ERROR) << "Database version " << version << " cannot be handled using migration";
throw LmsException { LMS_DATABASE_VERSION > version ? outdatedMsg : "Server binary outdated, please upgrade it to handle this database"};