progress on combining foreign_node_completer and relation_completer

This commit is contained in:
Sascha Kühl
2025-12-05 15:38:35 +01:00
parent 98da0884f1
commit 2e354b435c
20 changed files with 195 additions and 108 deletions
+25 -1
View File
@@ -8,11 +8,12 @@
#include "matador/orm/schema.hpp"
#include "../models/department.hpp"
#include "../models/recipe.hpp"
using namespace matador;
using namespace matador::test;
TEST_CASE_METHOD(SchemaFixture, "Test schema one-two-many", "[schema]") {
TEST_CASE_METHOD(SchemaFixture, "Test schema one-two-many", "[schema][one-to-many]") {
using namespace matador::test;
orm::schema repo(pool/*, "NoopSchema"*/);
@@ -34,3 +35,26 @@ TEST_CASE_METHOD(SchemaFixture, "Test schema one-two-many", "[schema]") {
REQUIRE(exists_result.is_ok());
REQUIRE(!exists_result.value());
}
TEST_CASE_METHOD(SchemaFixture, "Test schema many-to-many", "[schema][many-to-many]") {
using namespace matador::test;
orm::schema repo(pool/*, "NoopSchema"*/);
auto result = repo.attach<recipe>("recipes")
.and_then( [&repo] { return repo.attach<ingredient>("ingredients"); } );
REQUIRE(result);
result = repo.create();
REQUIRE(result);
auto exists_result = repo.table_exists("recipes");
REQUIRE(exists_result.is_ok());
REQUIRE(exists_result.value());
result = repo.drop();
REQUIRE(result);
exists_result = repo.table_exists("recipes");
REQUIRE(exists_result.is_ok());
REQUIRE(!exists_result.value());
}