#ifndef SQLGEN_BUILD_DRY_TESTS_ONLY #include #include #include #include #include #include namespace test_create_index { struct Person { sqlgen::PrimaryKey id; std::string first_name; std::string last_name; int age; }; TEST(postgres, test_create_index) { const auto credentials = sqlgen::postgres::Credentials{.user = "postgres", .password = "password", .host = "localhost", .dbname = "postgres"}; using namespace sqlgen; const auto people = sqlgen::postgres::connect(credentials) .and_then(drop | if_exists) .and_then(create_table | if_not_exists) .and_then(create_index<"test_table_ix", Person>( "first_name"_c, "last_name"_c) | if_not_exists) .and_then(sqlgen::read>) .value(); const std::string expected = R"([])"; EXPECT_EQ(rfl::json::write(people), expected); } } // namespace test_create_index #endif