diff --git a/drogon_ctl/templates/model_cc.csp b/drogon_ctl/templates/model_cc.csp index a3902aa2..7e0172b2 100644 --- a/drogon_ctl/templates/model_cc.csp +++ b/drogon_ctl/templates/model_cc.csp @@ -209,7 +209,7 @@ const std::string &[[className]]::getColumnName(size_t index) noexcept(false) } $$<<"\n"; } - if(@@.get("rdbms")=="postgresql") + if(@@.get("rdbms")=="postgresql"||@@.get("hasPrimaryKey")!=1) { $$<<"void "<("rdbms")=="mysql"||@@.get("rdbms")=="sqlite3") { + auto primaryKeyTypeString=@@.get("primaryKeyType"); $$<<"void "<(id);\n"; + if(primaryKeyTypeString!="uint64_t") + { + $$<<" _"<(static_cast<"<(id));\n"; + } + else + { + $$<<" _"<(id);\n"; + } break; } }