fixed some repository-related tests

This commit is contained in:
Sascha Kühl
2025-10-01 15:39:58 +02:00
parent 5d2d6d4a30
commit 12905e3df3
10 changed files with 45 additions and 15 deletions
+2 -3
View File
@@ -385,8 +385,7 @@ TEST_CASE_METHOD(QueryFixture, "Select statement with foreign key and for single
TEST_CASE_METHOD(QueryFixture, "Select statement with many to many relationship", "[query][join][many_to_many]") {
auto result = repo.attach<recipe>("recipes")
.and_then( [this] { return repo.attach<ingredient>("ingredients"); } )
.and_then( [this] { return repo.attach<recipe_ingredient>("recipe_ingredients"); } );
.and_then( [this] { return repo.attach<ingredient>("ingredients"); } );
auto res = query::create()
.table<recipe>("recipes", repo)
@@ -462,7 +461,7 @@ TEST_CASE_METHOD(QueryFixture, "Select statement with many to many relationship"
for (const auto &ri: recipe_ingredients) {
res = query::insert()
.into("recipe_ingredients", column_generator::generate<recipe_ingredient>(repo, true))
.into("recipe_ingredients", column_generator::generate(repo, "recipe_ingredients", true))
.values({ri.first, ri.second})
.execute(db);
REQUIRE(res.is_ok());
+1 -1
View File
@@ -28,7 +28,7 @@ struct flight {
namespace field = matador::access;
using namespace matador::utils;
field::primary_key(op, "id", id);
field::has_one(op, "airplane_id", plane, {utils::cascade_type::ALL, fetch_type::EAGER});
field::belongs_to(op, "airplane_id", plane, {utils::cascade_type::ALL, fetch_type::EAGER});
field::attribute(op, "pilot_name", pilot_name, 255);
}
};