Added date/time field for tracklist, added a LmsApplicationManager to make scrobbler register for played tracks

This commit is contained in:
emeric
2021-03-23 14:01:09 +01:00
parent 260e5833d3
commit 2c4be7468a
12 changed files with 151 additions and 220 deletions
+9 -3
View File
@@ -39,10 +39,11 @@
#include "database/TrackFeatures.hpp"
#include "database/User.hpp"
namespace Database {
namespace Database
{
using Version = std::size_t;
static constexpr Version LMS_DATABASE_VERSION {29};
static constexpr Version LMS_DATABASE_VERSION {30};
class VersionInfo
{
@@ -78,7 +79,7 @@ namespace Database {
private:
int _version {LMS_DATABASE_VERSION};
};
};
void
Session::doDatabaseMigrationIfNeeded()
@@ -315,6 +316,11 @@ CREATE TABLE "user_backup" (
_session.execute("DROP TABLE user");
_session.execute("ALTER TABLE user_backup RENAME TO user");
}
else if (version == 29)
{
// new field data_time in tracklist_entry (used by async scrobble or to make stats)
_session.execute("ALTER TABLE tracklist_entry ADD date_time TEXT");
}
else
{
LMS_LOG(DB, ERROR) << "Database version " << version << " cannot be handled using migration";