schema progress (does not compile)

This commit is contained in:
2025-12-31 11:56:12 +01:00
parent d104222fdd
commit ab2d39407c
65 changed files with 1355 additions and 922 deletions
+12 -10
View File
@@ -15,46 +15,48 @@ using namespace matador::test;
TEST_CASE_METHOD(SchemaFixture, "Test schema one-two-many", "[schema][one-to-many]") {
using namespace matador::test;
query::schema repo(pool/*, "NoopSchema"*/);
query::schema repo;
auto result = repo.attach<department>("departments")
.and_then([&repo] { return repo.attach<employee>("employees"); });
REQUIRE(result);
result = repo.create();
auto conn = pool.acquire();
result = repo.create(*conn);
REQUIRE(result);
auto exists_result = repo.table_exists("departments");
auto exists_result = repo.table_exists("departments", *conn);
REQUIRE(exists_result.is_ok());
REQUIRE(exists_result.value());
result = repo.drop();
result = repo.drop(*conn);
REQUIRE(result);
exists_result = repo.table_exists("departments");
exists_result = repo.table_exists("departments", *conn);
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;
query::schema repo(pool/*, "NoopSchema"*/);
query::schema repo;
auto result = repo.attach<recipe>("recipes")
.and_then([&repo] { return repo.attach<ingredient>("ingredients"); });
REQUIRE(result);
result = repo.create();
auto conn = pool.acquire();
result = repo.create(*conn);
REQUIRE(result);
auto exists_result = repo.table_exists("recipes");
auto exists_result = repo.table_exists("recipes", *conn);
REQUIRE(exists_result.is_ok());
REQUIRE(exists_result.value());
result = repo.drop();
result = repo.drop(*conn);
REQUIRE(result);
exists_result = repo.table_exists("recipes");
exists_result = repo.table_exists("recipes", *conn);
REQUIRE(exists_result.is_ok());
REQUIRE(!exists_result.value());
}