Introduced the artwork table. Now resolve the preferred release artwork during scan steps
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
add_library(lmsdatabase STATIC
|
||||
impl/Artist.cpp
|
||||
impl/ArtistInfo.cpp
|
||||
impl/Artwork.cpp
|
||||
impl/AuthToken.cpp
|
||||
impl/Cluster.cpp
|
||||
impl/Db.cpp
|
||||
|
||||
@@ -0,0 +1,77 @@
|
||||
/*
|
||||
* Copyright (C) 2025 Emeric Poupon
|
||||
*
|
||||
* This file is part of LMS.
|
||||
*
|
||||
* LMS is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* LMS is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with LMS. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "database/Artwork.hpp"
|
||||
|
||||
#include "database/Image.hpp"
|
||||
#include "database/Session.hpp"
|
||||
#include "database/TrackEmbeddedImage.hpp"
|
||||
|
||||
#include "Utils.hpp"
|
||||
#include "traits/IdTypeTraits.hpp"
|
||||
|
||||
namespace lms::db
|
||||
{
|
||||
Artwork::Artwork(ObjectPtr<TrackEmbeddedImage> trackEmbeddedImage)
|
||||
: _trackEmbeddedImage{ getDboPtr(trackEmbeddedImage) }
|
||||
{
|
||||
}
|
||||
|
||||
Artwork::Artwork(ObjectPtr<Image> image)
|
||||
: _image{ getDboPtr(image) }
|
||||
{
|
||||
}
|
||||
|
||||
Artwork::pointer Artwork::create(Session& session, ObjectPtr<TrackEmbeddedImage> trackEmbeddedImage)
|
||||
{
|
||||
session.checkWriteTransaction();
|
||||
return session.getDboSession()->add(std::unique_ptr<Artwork>{ new Artwork{ trackEmbeddedImage } });
|
||||
}
|
||||
|
||||
Artwork::pointer Artwork::create(Session& session, ObjectPtr<Image> image)
|
||||
{
|
||||
session.checkWriteTransaction();
|
||||
return session.getDboSession()->add(std::unique_ptr<Artwork>{ new Artwork{ image } });
|
||||
}
|
||||
|
||||
std::size_t Artwork::getCount(Session& session)
|
||||
{
|
||||
session.checkReadTransaction();
|
||||
return utils::fetchQuerySingleResult(session.getDboSession()->query<long>("SELECT COUNT(*) FROM artwork"));
|
||||
}
|
||||
|
||||
Artwork::pointer Artwork::find(Session& session, ArtworkId id)
|
||||
{
|
||||
session.checkReadTransaction();
|
||||
return utils::fetchQuerySingleResult(session.getDboSession()->query<Wt::Dbo::ptr<Artwork>>("SELECT a FROM artwork a").where("a.id = ?").bind(id));
|
||||
}
|
||||
|
||||
Artwork::pointer Artwork::find(Session& session, TrackEmbeddedImageId id)
|
||||
{
|
||||
session.checkReadTransaction();
|
||||
return utils::fetchQuerySingleResult(session.getDboSession()->query<Wt::Dbo::ptr<Artwork>>("SELECT a FROM artwork a JOIN track_embedded_image t_e_i ON a.track_embedded_image_id = t_e_i.id").where("t_e_i.id = ?").bind(id));
|
||||
}
|
||||
|
||||
Artwork::pointer Artwork::find(Session& session, ImageId id)
|
||||
{
|
||||
session.checkReadTransaction();
|
||||
return utils::fetchQuerySingleResult(session.getDboSession()->query<Wt::Dbo::ptr<Artwork>>("SELECT a FROM artwork a JOIN image i ON a.image_id = i.id").where("i.id = ?").bind(id));
|
||||
}
|
||||
|
||||
} // namespace lms::db
|
||||
@@ -23,7 +23,6 @@
|
||||
|
||||
#include "database/Artist.hpp"
|
||||
#include "database/Directory.hpp"
|
||||
#include "database/Release.hpp"
|
||||
#include "database/Session.hpp"
|
||||
|
||||
#include "Utils.hpp"
|
||||
|
||||
@@ -35,7 +35,7 @@ namespace lms::db
|
||||
{
|
||||
namespace
|
||||
{
|
||||
static constexpr Version LMS_DATABASE_VERSION{ 92 };
|
||||
static constexpr Version LMS_DATABASE_VERSION{ 93 };
|
||||
}
|
||||
|
||||
VersionInfo::VersionInfo()
|
||||
@@ -411,7 +411,7 @@ SELECT
|
||||
copyright_url,
|
||||
track_replay_gain,
|
||||
release_replay_gain,
|
||||
COALESCE(artist_display_name, ""),
|
||||
artist_display_name,
|
||||
release_id,
|
||||
1
|
||||
FROM track)");
|
||||
@@ -1219,6 +1219,58 @@ FROM tracklist)");
|
||||
utils::executeCommand(*session.getDboSession(), "ALTER TABLE track_embedded_image_link DROP COLUMN is_preferred");
|
||||
}
|
||||
|
||||
void migrateFromV92(Session& session)
|
||||
{
|
||||
// Create the new artwork table
|
||||
utils::executeCommand(*session.getDboSession(), R"(CREATE TABLE IF NOT EXISTS "artwork" (
|
||||
"id" integer primary key autoincrement,
|
||||
"version" integer not null,
|
||||
"track_embedded_image_id" bigint,
|
||||
"image_id" bigint,
|
||||
constraint "fk_artwork_track_embedded_image" foreign key ("track_embedded_image_id") references "track_embedded_image" ("id") on delete cascade deferrable initially deferred,
|
||||
constraint "fk_artwork_image" foreign key ("image_id") references "image" ("id") on delete cascade deferrable initially deferred))");
|
||||
|
||||
// Replaced image by artwork for release
|
||||
// Create the new table, copy the data, drop the old table, rename the new one
|
||||
utils::executeCommand(*session.getDboSession(), R"(CREATE TABLE IF NOT EXISTS "release_backup" (
|
||||
"id" integer primary key autoincrement,
|
||||
"version" integer not null,
|
||||
"name" text not null,
|
||||
"sort_name" text not null,
|
||||
"mbid" text not null,
|
||||
"group_mbid" text not null,
|
||||
"total_disc" integer,
|
||||
"artist_display_name" text not null,
|
||||
"is_compilation" boolean not null,
|
||||
"barcode" text not null,
|
||||
"comment" text not null,
|
||||
"preferred_artwork_id" bigint,
|
||||
constraint "fk_release_preferred_artwork" foreign key ("preferred_artwork_id") references "artwork" ("id") on delete set null deferrable initially deferred))");
|
||||
|
||||
// Migrate data, with the new preferred_artwork_id field set to null
|
||||
utils::executeCommand(*session.getDboSession(), R"(INSERT INTO release_backup
|
||||
SELECT
|
||||
id,
|
||||
version,
|
||||
name,
|
||||
sort_name,
|
||||
mbid,
|
||||
group_mbid,
|
||||
total_disc,
|
||||
COALESCE(artist_display_name, ''),
|
||||
is_compilation,
|
||||
barcode,
|
||||
comment,
|
||||
NULL as preferred_artwork_id
|
||||
FROM release)");
|
||||
|
||||
utils::executeCommand(*session.getDboSession(), "DROP TABLE release");
|
||||
utils::executeCommand(*session.getDboSession(), "ALTER TABLE release_backup RENAME TO release");
|
||||
|
||||
// Just increment the scan version of the settings to make the next scan rescan everything
|
||||
utils::executeCommand(*session.getDboSession(), "UPDATE scan_settings SET artist_info_scan_version = artist_info_scan_version + 1");
|
||||
}
|
||||
|
||||
bool doDbMigration(Session& session)
|
||||
{
|
||||
constexpr std::string_view outdatedMsg{ "Outdated database, please rebuild it (delete the .db file and restart)" };
|
||||
@@ -1286,7 +1338,8 @@ FROM tracklist)");
|
||||
{ 88, migrateFromV88 },
|
||||
{ 89, migrateFromV89 },
|
||||
{ 90, migrateFromV90 },
|
||||
{ 91, migrateFromV91 }
|
||||
{ 91, migrateFromV91 },
|
||||
{ 92, migrateFromV92 }
|
||||
};
|
||||
|
||||
bool migrationPerformed{};
|
||||
|
||||
@@ -23,9 +23,9 @@
|
||||
|
||||
#include "core/PartialDateTime.hpp"
|
||||
#include "database/Artist.hpp"
|
||||
#include "database/Artwork.hpp"
|
||||
#include "database/Cluster.hpp"
|
||||
#include "database/Directory.hpp"
|
||||
#include "database/Image.hpp"
|
||||
#include "database/Session.hpp"
|
||||
#include "database/Track.hpp"
|
||||
#include "database/Types.hpp"
|
||||
@@ -701,14 +701,9 @@ namespace lms::db
|
||||
return utils::fetchQueryResults<Release::pointer>(query);
|
||||
}
|
||||
|
||||
ObjectPtr<Image> Release::getImage() const
|
||||
ObjectPtr<Artwork> Release::getPreferredArtwork() const
|
||||
{
|
||||
return ObjectPtr<Image>{ _image };
|
||||
}
|
||||
|
||||
ImageId Release::getImageId() const
|
||||
{
|
||||
return _image.id();
|
||||
return ObjectPtr<Artwork>{ _preferredArtwork };
|
||||
}
|
||||
|
||||
void Release::clearLabels()
|
||||
@@ -741,9 +736,9 @@ namespace lms::db
|
||||
_releaseTypes.insert(getDboPtr(releaseType));
|
||||
}
|
||||
|
||||
void Release::setImage(ObjectPtr<Image> image)
|
||||
void Release::setPreferredArtwork(ObjectPtr<Artwork> artwork)
|
||||
{
|
||||
_image = getDboPtr(image);
|
||||
_preferredArtwork = getDboPtr(artwork);
|
||||
}
|
||||
|
||||
bool Release::hasVariousArtists() const
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
#include "core/ITraceLogger.hpp"
|
||||
#include "database/Artist.hpp"
|
||||
#include "database/ArtistInfo.hpp"
|
||||
#include "database/Artwork.hpp"
|
||||
#include "database/AuthToken.hpp"
|
||||
#include "database/Cluster.hpp"
|
||||
#include "database/Db.hpp"
|
||||
@@ -102,6 +103,7 @@ namespace lms::db
|
||||
|
||||
_session.mapClass<Artist>("artist");
|
||||
_session.mapClass<ArtistInfo>("artist_info");
|
||||
_session.mapClass<Artwork>("artwork");
|
||||
_session.mapClass<AuthToken>("auth_token");
|
||||
_session.mapClass<Cluster>("cluster");
|
||||
_session.mapClass<ClusterType>("cluster_type");
|
||||
@@ -206,6 +208,10 @@ namespace lms::db
|
||||
utils::executeCommand(_session, "CREATE INDEX IF NOT EXISTS artist_info_artist_id_idx ON artist_info(artist_id)");
|
||||
utils::executeCommand(_session, "CREATE INDEX IF NOT EXISTS artist_info_mbid_matched_artist_idx ON artist_info(mbid_matched, artist_id)");
|
||||
|
||||
utils::executeCommand(_session, "CREATE INDEX IF NOT EXISTS artwork_id_idx ON artwork(id)");
|
||||
utils::executeCommand(_session, "CREATE INDEX IF NOT EXISTS artwork_image_idx ON artwork(image_id)");
|
||||
utils::executeCommand(_session, "CREATE INDEX IF NOT EXISTS artwork_track_embedded_image_idx ON artwork(track_embedded_image_id)");
|
||||
|
||||
utils::executeCommand(_session, "CREATE INDEX IF NOT EXISTS auth_token_user_domain_idx ON auth_token(user_id, domain)");
|
||||
utils::executeCommand(_session, "CREATE INDEX IF NOT EXISTS auth_token_domain_expiry_idx ON auth_token(domain, expiry)");
|
||||
utils::executeCommand(_session, "CREATE INDEX IF NOT EXISTS auth_token_domain_value_idx ON auth_token(domain, value)");
|
||||
@@ -256,7 +262,6 @@ namespace lms::db
|
||||
utils::executeCommand(_session, "CREATE INDEX IF NOT EXISTS rated_track_user_track_idx ON rated_track(user_id,track_id)");
|
||||
|
||||
utils::executeCommand(_session, "CREATE INDEX IF NOT EXISTS release_id_idx ON release(id)");
|
||||
utils::executeCommand(_session, "CREATE INDEX IF NOT EXISTS release_image_idx ON release(image_id)");
|
||||
utils::executeCommand(_session, "CREATE INDEX IF NOT EXISTS release_group_mbid_idx ON release(group_mbid)");
|
||||
utils::executeCommand(_session, "CREATE INDEX IF NOT EXISTS release_mbid_idx ON release(mbid)");
|
||||
utils::executeCommand(_session, "CREATE INDEX IF NOT EXISTS release_name_idx ON release(name)");
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2021 Emeric Poupon
|
||||
* Copyright (C) 2025 Emeric Poupon
|
||||
*
|
||||
* This file is part of LMS.
|
||||
*
|
||||
|
||||
@@ -0,0 +1,67 @@
|
||||
/*
|
||||
* Copyright (C) 2025 Emeric Poupon
|
||||
*
|
||||
* This file is part of LMS.
|
||||
*
|
||||
* LMS is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* LMS is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with LMS. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <Wt/Dbo/Dbo.h>
|
||||
|
||||
#include "database/ArtworkId.hpp"
|
||||
#include "database/ImageId.hpp"
|
||||
#include "database/Object.hpp"
|
||||
#include "database/TrackEmbeddedImageId.hpp"
|
||||
|
||||
namespace lms::db
|
||||
{
|
||||
class Image;
|
||||
class Session;
|
||||
class TrackEmbeddedImage;
|
||||
|
||||
class Artwork final : public Object<Artwork, ArtworkId>
|
||||
{
|
||||
public:
|
||||
Artwork() = default;
|
||||
|
||||
// find
|
||||
static std::size_t getCount(Session& session);
|
||||
static pointer find(Session& session, ArtworkId id);
|
||||
static pointer find(Session& session, TrackEmbeddedImageId id);
|
||||
static pointer find(Session& session, ImageId id);
|
||||
|
||||
// getters
|
||||
TrackEmbeddedImageId getTrackEmbeddedImageId() const { return _trackEmbeddedImage.id(); }
|
||||
ImageId getImageId() const { return _image.id(); }
|
||||
|
||||
template<class Action>
|
||||
void persist(Action& a)
|
||||
{
|
||||
Wt::Dbo::belongsTo(a, _trackEmbeddedImage, "track_embedded_image", Wt::Dbo::OnDeleteCascade);
|
||||
Wt::Dbo::belongsTo(a, _image, "image", Wt::Dbo::OnDeleteCascade);
|
||||
}
|
||||
|
||||
private:
|
||||
friend class Session;
|
||||
Artwork(ObjectPtr<TrackEmbeddedImage> trackEmbeddedImage);
|
||||
Artwork(ObjectPtr<Image> image);
|
||||
static pointer create(Session& session, ObjectPtr<TrackEmbeddedImage> trackEmbeddedImage);
|
||||
static pointer create(Session& session, ObjectPtr<Image> image);
|
||||
|
||||
Wt::Dbo::ptr<TrackEmbeddedImage> _trackEmbeddedImage;
|
||||
Wt::Dbo::ptr<Image> _image;
|
||||
};
|
||||
} // namespace lms::db
|
||||
@@ -0,0 +1,24 @@
|
||||
/*
|
||||
* Copyright (C) 2025 Emeric Poupon
|
||||
*
|
||||
* This file is part of LMS.
|
||||
*
|
||||
* LMS is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* LMS is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with LMS. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "database/IdType.hpp"
|
||||
|
||||
LMS_DECLARE_IDTYPE(ArtworkId)
|
||||
@@ -34,7 +34,6 @@ namespace lms::db
|
||||
{
|
||||
class Artist;
|
||||
class Directory;
|
||||
class Release;
|
||||
class Session;
|
||||
|
||||
class Image final : public Object<Image, ImageId>
|
||||
@@ -101,7 +100,6 @@ namespace lms::db
|
||||
Wt::Dbo::field(a, _height, "height");
|
||||
|
||||
Wt::Dbo::hasMany(a, _artists, Wt::Dbo::ManyToOne, "image");
|
||||
Wt::Dbo::hasMany(a, _releases, Wt::Dbo::ManyToOne, "image");
|
||||
Wt::Dbo::belongsTo(a, _directory, "directory", Wt::Dbo::OnDeleteCascade);
|
||||
}
|
||||
|
||||
@@ -118,7 +116,6 @@ namespace lms::db
|
||||
int _height{};
|
||||
|
||||
Wt::Dbo::collection<Wt::Dbo::ptr<Artist>> _artists;
|
||||
Wt::Dbo::collection<Wt::Dbo::ptr<Release>> _releases;
|
||||
Wt::Dbo::ptr<Directory> _directory;
|
||||
};
|
||||
} // namespace lms::db
|
||||
|
||||
@@ -31,10 +31,10 @@
|
||||
#include "core/PartialDateTime.hpp"
|
||||
#include "core/UUID.hpp"
|
||||
#include "database/ArtistId.hpp"
|
||||
#include "database/ArtworkId.hpp"
|
||||
#include "database/CountryId.hpp"
|
||||
#include "database/DirectoryId.hpp"
|
||||
#include "database/Filters.hpp"
|
||||
#include "database/ImageId.hpp"
|
||||
#include "database/LabelId.hpp"
|
||||
#include "database/MediaLibraryId.hpp"
|
||||
#include "database/Object.hpp"
|
||||
@@ -46,9 +46,9 @@
|
||||
namespace lms::db
|
||||
{
|
||||
class Artist;
|
||||
class Artwork;
|
||||
class Cluster;
|
||||
class ClusterType;
|
||||
class Image;
|
||||
class Release;
|
||||
class Session;
|
||||
class Track;
|
||||
@@ -292,8 +292,8 @@ namespace lms::db
|
||||
core::EnumSet<Advisory> getAdvisories() const;
|
||||
std::string_view getBarcode() const { return _barcode; }
|
||||
std::string_view getComment() const { return _comment; }
|
||||
ObjectPtr<Image> getImage() const;
|
||||
ImageId getImageId() const;
|
||||
ObjectPtr<Artwork> getPreferredArtwork() const;
|
||||
ArtworkId getPreferredArtworkId() const;
|
||||
|
||||
// Setters
|
||||
void setName(std::string_view name) { _name = name; }
|
||||
@@ -311,7 +311,7 @@ namespace lms::db
|
||||
void addReleaseType(ObjectPtr<ReleaseType> releaseType);
|
||||
void setBarcode(std::string_view barcode) { _barcode = barcode; }
|
||||
void setComment(std::string_view comment) { _comment = comment; }
|
||||
void setImage(ObjectPtr<Image> image);
|
||||
void setPreferredArtwork(ObjectPtr<Artwork> artwork);
|
||||
|
||||
// Get the artists of this release
|
||||
std::vector<ObjectPtr<Artist>> getArtists(TrackArtistLinkType type = TrackArtistLinkType::Artist) const;
|
||||
@@ -333,9 +333,9 @@ namespace lms::db
|
||||
Wt::Dbo::field(a, _isCompilation, "is_compilation");
|
||||
Wt::Dbo::field(a, _barcode, "barcode");
|
||||
Wt::Dbo::field(a, _comment, "comment");
|
||||
Wt::Dbo::hasMany(a, _tracks, Wt::Dbo::ManyToOne, "release");
|
||||
|
||||
Wt::Dbo::belongsTo(a, _image, "image", Wt::Dbo::OnDeleteSetNull);
|
||||
Wt::Dbo::hasMany(a, _tracks, Wt::Dbo::ManyToOne, "release");
|
||||
Wt::Dbo::belongsTo(a, _preferredArtwork, "preferred_artwork", Wt::Dbo::OnDeleteSetNull);
|
||||
Wt::Dbo::hasMany(a, _labels, Wt::Dbo::ManyToMany, "release_label", "", Wt::Dbo::OnDeleteCascade);
|
||||
Wt::Dbo::hasMany(a, _releaseTypes, Wt::Dbo::ManyToMany, "release_release_type", "", Wt::Dbo::OnDeleteCascade);
|
||||
Wt::Dbo::hasMany(a, _countries, Wt::Dbo::ManyToMany, "release_country", "", Wt::Dbo::OnDeleteCascade);
|
||||
@@ -361,8 +361,8 @@ namespace lms::db
|
||||
std::string _barcode;
|
||||
std::string _comment;
|
||||
|
||||
Wt::Dbo::ptr<Image> _image;
|
||||
Wt::Dbo::collection<Wt::Dbo::ptr<Track>> _tracks;
|
||||
Wt::Dbo::ptr<Artwork> _preferredArtwork;
|
||||
Wt::Dbo::collection<Wt::Dbo::ptr<Label>> _labels;
|
||||
Wt::Dbo::collection<Wt::Dbo::ptr<ReleaseType>> _releaseTypes;
|
||||
Wt::Dbo::collection<Wt::Dbo::ptr<Country>> _countries;
|
||||
|
||||
@@ -20,10 +20,12 @@
|
||||
#include "Common.hpp"
|
||||
|
||||
#include "core/PartialDateTime.hpp"
|
||||
#include "database/Artwork.hpp"
|
||||
#include "database/Image.hpp"
|
||||
|
||||
namespace lms::db::tests
|
||||
{
|
||||
using ScopedArtwork = ScopedEntity<db::Artwork>;
|
||||
using ScopedImage = ScopedEntity<db::Image>;
|
||||
using ScopedLabel = ScopedEntity<db::Label>;
|
||||
using ScopedCountry = ScopedEntity<db::Country>;
|
||||
@@ -1195,27 +1197,28 @@ namespace lms::db::tests
|
||||
}
|
||||
}
|
||||
|
||||
TEST_F(DatabaseFixture, Release_image)
|
||||
TEST_F(DatabaseFixture, Release_artwork)
|
||||
{
|
||||
ScopedRelease release{ session, "MyRelease" };
|
||||
|
||||
{
|
||||
auto transaction{ session.createReadTransaction() };
|
||||
EXPECT_FALSE(release.get()->getImage());
|
||||
EXPECT_FALSE(release.get()->getPreferredArtwork());
|
||||
}
|
||||
|
||||
ScopedImage image{ session, "/myImage" };
|
||||
ScopedImage image{ session, "/image.jpg" };
|
||||
ScopedArtwork artwork{ session, image.lockAndGet() };
|
||||
|
||||
{
|
||||
auto transaction{ session.createWriteTransaction() };
|
||||
release.get().modify()->setImage(image.get());
|
||||
release.get().modify()->setPreferredArtwork(artwork.get());
|
||||
}
|
||||
|
||||
{
|
||||
auto transaction{ session.createReadTransaction() };
|
||||
auto releaseImage(release.get()->getImage());
|
||||
ASSERT_TRUE(releaseImage);
|
||||
EXPECT_EQ(releaseImage->getId(), image.getId());
|
||||
auto releaseArtwork(release.get()->getPreferredArtwork());
|
||||
ASSERT_TRUE(releaseArtwork);
|
||||
EXPECT_EQ(releaseArtwork->getId(), artwork.getId());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user