From 8d17cc567e99fdb410115ffa1bf6e06d659ad668 Mon Sep 17 00:00:00 2001 From: An Tao Date: Sun, 1 Mar 2020 16:48:18 +0800 Subject: [PATCH] Fix the 'many to many' relationship (#369) --- drogon_ctl/create_model.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drogon_ctl/create_model.cc b/drogon_ctl/create_model.cc index ddeebca7..e49a70a8 100644 --- a/drogon_ctl/create_model.cc +++ b/drogon_ctl/create_model.cc @@ -64,7 +64,8 @@ static std::map> getRelationships( Relationship r(relationship); ret[r.originalTableName()].push_back(r); if (r.enableReverse() && - r.originalTableName() != r.targetTableName()) + (r.originalTableName() != r.targetTableName() || + r.originalTableAlias() != r.targetTableAlias())) { auto reverse = r.reverse(); ret[reverse.originalTableName()].push_back(reverse);