File tree 2 files changed +15
-1
lines changed
floor_generator/lib/processor
2 files changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -221,7 +221,8 @@ class EntityProcessor extends QueryableProcessor<Entity> {
221
221
.getAnnotation (annotations.Entity )
222
222
? .getField (AnnotationField .entityPrimaryKeys)
223
223
? .toListValue ()
224
- ? .map ((object) => object.toStringValue ());
224
+ ? .map ((object) => object.toStringValue ())
225
+ .toSet ();
225
226
226
227
if (compoundPrimaryKeyColumnNames == null ||
227
228
compoundPrimaryKeyColumnNames.isEmpty) {
@@ -237,6 +238,11 @@ class EntityProcessor extends QueryableProcessor<Entity> {
237
238
throw _processorError.missingPrimaryKey;
238
239
}
239
240
241
+ if (compoundPrimaryKeyFields.length !=
242
+ compoundPrimaryKeyColumnNames.length) {
243
+ throw _processorError.primaryKeyNotFound;
244
+ }
245
+
240
246
return PrimaryKey (compoundPrimaryKeyFields, false );
241
247
}
242
248
Original file line number Diff line number Diff line change @@ -18,6 +18,14 @@ class EntityProcessorError {
18
18
);
19
19
}
20
20
21
+ InvalidGenerationSourceError get primaryKeyNotFound {
22
+ return InvalidGenerationSourceError (
23
+ 'Primary key not found for ${_classElement .displayName }.' ,
24
+ todo: 'Make sure that all the primary keys you defined exist as columns.' ,
25
+ element: _classElement,
26
+ );
27
+ }
28
+
21
29
InvalidGenerationSourceError get missingParentColumns {
22
30
return InvalidGenerationSourceError (
23
31
'No parent columns defined for foreign key.' ,
You can’t perform that action at this time.
0 commit comments