From 0179816c1973eca632cd85a064f0f2450861a01c Mon Sep 17 00:00:00 2001 From: antao Date: Fri, 2 Nov 2018 10:03:50 +0800 Subject: [PATCH] Fix a bug for the system without database --- drogon_ctl/create_model.cc | 9 +++++---- drogon_ctl/create_model.h | 3 ++- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/drogon_ctl/create_model.cc b/drogon_ctl/create_model.cc index 0fb94d2f..c5ca0493 100644 --- a/drogon_ctl/create_model.cc +++ b/drogon_ctl/create_model.cc @@ -16,9 +16,6 @@ #include #include -#if USE_POSTGRESQL -#include -#endif #include #include #include @@ -33,7 +30,6 @@ #include using namespace drogon_ctl; -using namespace drogon::orm; std::string nameTransform(const std::string &origName, bool isType) { @@ -313,6 +309,7 @@ void create_model::createModel(const std::string &path) void create_model::handleCommand(std::vector ¶meters) { +#if USE_POSTGRESQL std::cout << "Create model" << std::endl; if (parameters.size() == 0) { @@ -322,4 +319,8 @@ void create_model::handleCommand(std::vector ¶meters) { createModel(path); } +#else + std::cout << "No database can be found in your system, please install one first!" << std::endl; + exit(1); +#endif } diff --git a/drogon_ctl/create_model.h b/drogon_ctl/create_model.h index 0d761870..dcfdf731 100644 --- a/drogon_ctl/create_model.h +++ b/drogon_ctl/create_model.h @@ -17,13 +17,14 @@ #include #if USE_POSTGRESQL #include +using namespace drogon::orm; #endif #include #include "CommandHandler.h" #include using namespace drogon; -using namespace drogon::orm; + namespace drogon_ctl {