#include #include "matador/sql/backend_provider.hpp" #include "matador/sql/connection_pool.hpp" #include "matador/orm/schema.hpp" #include "../orm/backend/test_connection.hpp" #include "../orm/backend/test_backend_service.hpp" #include "../models/department.hpp" using namespace matador; TEST_CASE("Test schema", "[schema]") { using namespace matador::test; sql::backend_provider::instance().register_backend("noop", std::make_unique()); sql::connection_pool pool("noop://noop.db", 4); matador::orm::schema repo(pool, "NoopSchema"); auto result = repo.attach("departments") .and_then( [&repo] { return repo.attach("employees"); } ); REQUIRE(result); result = repo.create(); REQUIRE(result); const auto exists_result = repo.table_exists("departments"); REQUIRE(exists_result.is_ok()); REQUIRE(exists_result.value()); }