From 1b2dc1ca43a802c2f2574bcf86c46675a5534b0b Mon Sep 17 00:00:00 2001 From: Chris Tsang Date: Sat, 26 Jun 2021 22:06:10 +0800 Subject: [PATCH] Revert examples --- examples/codegen/src/out/cake.rs | 10 ++++++++-- examples/codegen/src/out/cake_filling.rs | 4 ++-- examples/codegen/src/out/filling.rs | 5 ++++- examples/codegen/src/out/fruit.rs | 2 +- 4 files changed, 15 insertions(+), 6 deletions(-) diff --git a/examples/codegen/src/out/cake.rs b/examples/codegen/src/out/cake.rs index 9b786a5f..87ee5f1a 100644 --- a/examples/codegen/src/out/cake.rs +++ b/examples/codegen/src/out/cake.rs @@ -53,8 +53,14 @@ impl ColumnTrait for Column { impl RelationTrait for Relation { fn def(&self) -> RelationDef { match self { - Self::CakeFilling => Entity::has_many(super::cake_filling::Entity).into(), - Self::Fruit => Entity::has_many(super::fruit::Entity).into(), + Self::CakeFilling => Entity::has_many(super::cake_filling::Entity) + .from(Column::Id) + .to(super::cake_filling::Column::CakeId) + .into(), + Self::Fruit => Entity::has_many(super::fruit::Entity) + .from(Column::Id) + .to(super::fruit::Column::CakeId) + .into(), } } } diff --git a/examples/codegen/src/out/cake_filling.rs b/examples/codegen/src/out/cake_filling.rs index d5b4b8b6..b35279d4 100644 --- a/examples/codegen/src/out/cake_filling.rs +++ b/examples/codegen/src/out/cake_filling.rs @@ -54,11 +54,11 @@ impl ColumnTrait for Column { impl RelationTrait for Relation { fn def(&self) -> RelationDef { match self { - Self::Cake => Entity::belongs_to(super::cake::Entity) + Self::Cake => Entity::has_one(super::cake::Entity) .from(Column::CakeId) .to(super::cake::Column::Id) .into(), - Self::Filling => Entity::belongs_to(super::filling::Entity) + Self::Filling => Entity::has_one(super::filling::Entity) .from(Column::FillingId) .to(super::filling::Column::Id) .into(), diff --git a/examples/codegen/src/out/filling.rs b/examples/codegen/src/out/filling.rs index e4563e55..4134652f 100644 --- a/examples/codegen/src/out/filling.rs +++ b/examples/codegen/src/out/filling.rs @@ -52,7 +52,10 @@ impl ColumnTrait for Column { impl RelationTrait for Relation { fn def(&self) -> RelationDef { match self { - Self::CakeFilling => Entity::has_many(super::cake_filling::Entity).into(), + Self::CakeFilling => Entity::has_many(super::cake_filling::Entity) + .from(Column::Id) + .to(super::cake_filling::Column::FillingId) + .into(), } } } diff --git a/examples/codegen/src/out/fruit.rs b/examples/codegen/src/out/fruit.rs index f65d5b38..17f653ed 100644 --- a/examples/codegen/src/out/fruit.rs +++ b/examples/codegen/src/out/fruit.rs @@ -55,7 +55,7 @@ impl ColumnTrait for Column { impl RelationTrait for Relation { fn def(&self) -> RelationDef { match self { - Self::Cake => Entity::belongs_to(super::cake::Entity) + Self::Cake => Entity::has_one(super::cake::Entity) .from(Column::CakeId) .to(super::cake::Column::Id) .into(),