added test for creating table with identity primary key
This commit is contained in:
parent
ae7c1f510f
commit
ac75bb6e3a
|
|
@ -153,6 +153,31 @@ TEST_CASE_METHOD(QueryFixture, "Create and drop table statement", "[query][recor
|
||||||
check_table_not_exists("person");
|
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]")
|
TEST_CASE_METHOD(QueryFixture, "Create and drop table statement with foreign key", "[query][record]")
|
||||||
{
|
{
|
||||||
auto res = query::create()
|
auto res = query::create()
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue