From c3f5ba9aa068fc4db7f270ae62ca8754d794efaa Mon Sep 17 00:00:00 2001 From: Alexander Wilde Date: Sat, 4 Apr 2020 01:04:37 +0100 Subject: [PATCH] Fix generating class for results with nested results. --- moor_generator/lib/src/model/sql_query.dart | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/moor_generator/lib/src/model/sql_query.dart b/moor_generator/lib/src/model/sql_query.dart index cc4a254d..f598effb 100644 --- a/moor_generator/lib/src/model/sql_query.dart +++ b/moor_generator/lib/src/model/sql_query.dart @@ -163,7 +163,8 @@ class InferredResultSet { /// Whether a new class needs to be written to store the result of this query. /// We don't need to do that for queries which return an existing table model /// or if they only return exactly one column. - bool get needsOwnClass => matchingTable == null && columns.length > 1; + bool get needsOwnClass => matchingTable == null && columns.length > 1 + || nestedResults.isNotEmpty; /// Whether this query returns a single column that should be returned /// directly.