You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
One could define child-to-parent relation and query parent::Model on seaography. However, the parent-to-child relation will fetch child::Model but not Vec<child::Model>.
#[derive(Copy,Clone,Debug,EnumIter,DeriveRelation,RelationsCompact)]pubenumRelation{#[sea_orm( belongs_to = "super::deck::Entity", from = "super::deck::Column::ParentId", to = "super::deck::Column::Id",)]Parent,#[sea_orm( belongs_to = "super::deck::Entity", from = "super::deck::Column::Id", to = "super::deck::Column::ParentId",)]Child,}
Proposed Solutions
A #[seaography(has_many)] proc attribute to override the default: fetching Model instead of Vec<Model> for belongs_to relation.
#[derive(Copy,Clone,Debug,EnumIter,DeriveRelation,RelationsCompact)]pubenumRelation{#[sea_orm( belongs_to = "super::deck::Entity", from = "super::deck::Column::Id", to = "super::deck::Column::ParentId",)]#[seaography(has_many)]Child,}
I believe we need to change this part in the derive macro.
## PR Info
- Closes#94
## New Features
- [X] Relations derive produces the reverse of a SelfRef relation
## Bug Fixes
- [X] Relations derive could not handle properly SelfRef relations
Motivation
One could define child-to-parent relation and query
parent::Model
on seaography. However, the parent-to-child relation will fetchchild::Model
but notVec<child::Model>
.Proposed Solutions
A
#[seaography(has_many)]
proc attribute to override the default: fetchingModel
instead ofVec<Model>
forbelongs_to
relation.I believe we need to change this part in the derive macro.
seaography/derive/src/relation.rs
Lines 188 to 200 in 04c3034
Additional Information
Context: https://discord.com/channels/873880840487206962/1039063562083127326
The text was updated successfully, but these errors were encountered: