-
Notifications
You must be signed in to change notification settings - Fork 199
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(datastore): fix has-one associations #1676
base: v1
Are you sure you want to change the base?
Changes from all commits
c16b226
0280479
c7c1681
c65ae8f
0829399
d5c647a
152c04d
b81b8be
6f2f1cb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -107,7 +107,20 @@ extension ModelSchema { | |
/// the owner of a foreign key to another `Model`. Fields that reference the inverse side of | ||
/// the relationship (i.e. the "one" side of a "one-to-many" relationship) are excluded. | ||
var columns: [ModelField] { | ||
sortedFields.filter { !$0.hasAssociation || $0.isForeignKey } | ||
return sortedFields.filter { | ||
!$0.hasAssociation || $0.isForeignKey | ||
} | ||
} | ||
|
||
/// This is a temporary workaround to circumvent a Codegen issue where | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can we add a link to more information to track the removal of this temp workaround? perhaps an issue in our repo to describe the situation |
||
/// both the field representing an association and its target are explicitly emitted. | ||
/// Warning: don't use it unless necessary, it will be removed in future releases. | ||
/// Returns fields that represent actual columns on the SQL table. | ||
/// It also exclude explicit fields that are referenced as an association target | ||
/// (i.e. team: Team => teamId: ID). | ||
var columnsUnique: [ModelField] { | ||
return columns | ||
.filter { !associationsTargets.contains($0.name) } | ||
} | ||
|
||
/// Filter the fields that represent foreign keys. | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -58,7 +58,7 @@ class DataStoreConnectionScenario2FlutterTests: SyncEngineFlutterIntegrationTest | |
return | ||
} | ||
let saveTeamCompleted = expectation(description: "save team completed") | ||
plugin.save(team.model, modelSchema: Team1.schema) { result in | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. fixed as in this scenario we are testing models |
||
plugin.save(team.model, modelSchema: Team2.schema) { result in | ||
switch result { | ||
case .success: | ||
saveTeamCompleted.fulfill() | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
those models were missing, so the selection set in queries wasn't properly generated (see GraphQL queries below)