/*
This file is part of libdjinterop.
libdjinterop is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
libdjinterop 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 Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with libdjinterop. If not, see <http://www.gnu.org/licenses/>.
*/
#include <sqlite_modern_cpp.h>
#include <djinterop/djinterop.hpp>
#include <djinterop/enginelibrary/schema_1_7_1.hpp>
#include <djinterop/enginelibrary/schema_validate_utils.hpp>
#include <djinterop/impl/util.hpp>
namespace djinterop::enginelibrary
{
static void verify_album_art(sqlite::database &db)
{
{
table_info cols{db, "AlbumArt"};
auto iter = cols.begin(), end = cols.end();
validate(iter, end, "albumArt", "BLOB", 0, "", 0);
++iter;
validate(iter, end, "hash", "TEXT", 0, "", 0);
++iter;
validate(iter, end, "id", "INTEGER", 0, "", 1);
++iter;
validate_no_more(iter, end, "table_info", "AlbumArt");
}
{
index_list indices{db, "AlbumArt"};
auto iter = indices.begin(), end = indices.end();
validate(iter, end, "index_AlbumArt_hash", 0, "c", 0);
++iter;
validate(iter, end, "index_AlbumArt_id", 0, "c", 0);
++iter;
validate_no_more(iter, end, "index_list", "AlbumArt");
}
{
index_info ii{db, "index_AlbumArt_hash"};
auto iter = ii.begin(), end = ii.end();
validate(iter, end, 0, "hash");
++iter;
validate_no_more(iter, end, "index_info", "index_AlbumArt_hash");
}
{
index_info ii{db, "index_AlbumArt_id"};
auto iter = ii.begin(), end = ii.end();
validate(iter, end, 0, "id");
++iter;
validate_no_more(iter, end, "index_info", "index_AlbumArt_id");
}
}
static void verify_copied_track(sqlite::database &db)
{
{
table_info cols{db, "CopiedTrack"};
auto iter = cols.begin(), end = cols.end();
validate(iter, end, "idOfTrackInSourceDatabase", "INTEGER", 0, "", 0);
++iter;
validate(iter, end, "trackId", "INTEGER", 0, "", 1);
++iter;
validate(iter, end, "uuidOfSourceDatabase", "TEXT", 0, "", 0);
++iter;
validate_no_more(iter, end, "table_info", "CopiedTrack");
}
{
index_list indices{db, "CopiedTrack"};
auto iter = indices.begin(), end = indices.end();
validate(iter, end, "index_CopiedTrack_trackId", 0, "c", 0);
++iter;
validate_no_more(iter, end, "index_list", "CopiedTrack");
}
{
index_info ii{db, "index_CopiedTrack_trackId"};
auto iter = ii.begin(), end = ii.end();
validate(iter, end, 0, "trackId");
++iter;
validate_no_more(iter, end, "index_info", "index_CopiedTrack_trackId");
}
}
static void verify_crate(sqlite::database &db)
{
{
table_info cols{db, "Crate"};
auto iter = cols.begin(), end = cols.end();
validate(iter, end, "id", "INTEGER", 0, <