From ac75bb6e3af7b59ecfd719dd41a4c328da766c7f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sascha=20K=C3=BChl?= Date: Mon, 16 Feb 2026 11:29:47 +0100 Subject: [PATCH] added test for creating table with identity primary key --- test/backends/QueryRecordTest.cpp | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/test/backends/QueryRecordTest.cpp b/test/backends/QueryRecordTest.cpp index 2d42731..57d1f97 100644 --- a/test/backends/QueryRecordTest.cpp +++ b/test/backends/QueryRecordTest.cpp @@ -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()