buildRelationMutationsFromResult method
Rebuild relation mutations using the parent id from the main mutation's
RETURNING row — this fixes nested writes on a create whose PK is
DB-generated (@default(uuid())), where the id isn't known at compile.
Implementation
List<SqlQuery> buildRelationMutationsFromResult(
JsonQuery query,
Map<String, dynamic>? resultRow,
) {
final effectiveSchema = schema ?? schemaRegistry;
final parentModel = effectiveSchema.getModel(query.modelName);
final pkCol = parentModel?.primaryKeys.isNotEmpty == true
? parentModel!.primaryKeys.first.columnName
: 'id';
final parentId = resultRow?[pkCol] ?? _compileTimeParentId(query);
return _buildRelationMutations(query, parentId);
}