added test for creating table with identity primary key

This commit is contained in:
Sascha Kühl 2026-02-16 11:29:47 +01:00
parent ae7c1f510f
commit ac75bb6e3a
1 changed files with 25 additions and 0 deletions

View File

@ -153,6 +153,31 @@ TEST_CASE_METHOD(QueryFixture, "Create and drop table statement", "[query][recor
check_table_not_exists("person");
}
TEST_CASE_METHOD(QueryFixture, "Create table with identity primary key", "[query][record][create][identity]") {
check_table_not_exists("person");
auto res = query::create()
.table("person")
.columns({
column("id", basic_type::UInt32).primary_key().identity(),
column("name", basic_type::Varchar, 255),
column("age", basic_type::UInt16)
})
.execute(db);
REQUIRE(res.is_ok());
REQUIRE(res->affected_rows == 0);
check_table_exists("person");
tables_to_drop.emplace("person");
res = query::drop()
.table("person")
.execute(db);
REQUIRE(res.is_ok());
REQUIRE(res->affected_rows == 0);
check_table_not_exists("person");
}
TEST_CASE_METHOD(QueryFixture, "Create and drop table statement with foreign key", "[query][record]")
{
auto res = query::create()