Skip to content

Commit

Permalink
test create table with unique
Browse files Browse the repository at this point in the history
  • Loading branch information
Jacyking committed Jul 11, 2023
1 parent 20c3c5c commit 23b77f6
Showing 1 changed file with 20 additions and 12 deletions.
32 changes: 20 additions & 12 deletions tests/test_ormpp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -878,17 +878,6 @@ TEST_CASE("orm_aop") {
// REQUIRE(r);
}

#ifdef ORMPP_ENABLE_SQLITE3
TEST_CASE("test create table with unique") {
dbng<sqlite> sqlite;
if (sqlite.connect(db)) {
sqlite.execute("drop table if exists person");
CHECK(sqlite.create_datatable<person>(ormpp_auto_key{"id"},
ormpp_unique{"name"}));
}
}
#endif

#ifdef ORMPP_ENABLE_MYSQL
struct image {
int id;
Expand Down Expand Up @@ -961,4 +950,23 @@ TEST_CASE("orm_mysql_blob_tuple") {
REQUIRE(img.bin.size() == size);
REQUIRE(time == img_ex.time);
}
#endif
#endif

TEST_CASE("test create table with unique") {
#ifdef ORMPP_ENABLE_MYSQL
dbng<mysql> mysql;
if (mysql.connect(ip, "root", password, db)) {
mysql.execute("drop table if exists person");
CHECK(mysql.create_datatable<person>(ormpp_auto_key{"id"},
ormpp_unique{"name"}));
}
#endif
#ifdef ORMPP_ENABLE_SQLITE3
dbng<sqlite> sqlite;
if (sqlite.connect(db)) {
sqlite.execute("drop table if exists person");
CHECK(sqlite.create_datatable<person>(ormpp_auto_key{"id"},
ormpp_unique{"name"}));
}
#endif
}

0 comments on commit 23b77f6

Please sign in to comment.