22
33use sea_orm:: entity:: prelude:: * ;
44
5- #[ derive( Clone , Debug , PartialEq , DeriveEntityModel ) ]
5+ #[ derive( Clone , Debug , PartialEq , DeriveEntityModel , Eq ) ]
66#[ sea_orm( table_name = "statistic" ) ]
77pub struct Model {
88 #[ sea_orm( primary_key) ]
99 pub id : i32 ,
1010 pub name : String ,
1111 pub table_id : i32 ,
12- pub epoch_id : i32 ,
1312 pub created_time : DateTimeUtc ,
1413 pub number_of_attributes : i32 ,
1514 pub statistic_type : i32 ,
16- #[ sea_orm( column_type = "Float" ) ]
17- pub statistic_value : f32 ,
15+ pub description : String ,
1816}
1917
2018#[ derive( Copy , Clone , Debug , EnumIter , DeriveRelation ) ]
2119pub enum Relation {
22- #[ sea_orm(
23- belongs_to = "super::event::Entity" ,
24- from = "Column::EpochId" ,
25- to = "super::event::Column::EpochId" ,
26- on_update = "Cascade" ,
27- on_delete = "Cascade"
28- ) ]
29- Event ,
20+ #[ sea_orm( has_many = "super::physical_expression_to_statistic_junction::Entity" ) ]
21+ PhysicalExpressionToStatisticJunction ,
3022 #[ sea_orm( has_many = "super::statistic_to_attribute_junction::Entity" ) ]
3123 StatisticToAttributeJunction ,
3224 #[ sea_orm(
@@ -37,11 +29,13 @@ pub enum Relation {
3729 on_delete = "Cascade"
3830 ) ]
3931 TableMetadata ,
32+ #[ sea_orm( has_many = "super::versioned_statistic::Entity" ) ]
33+ VersionedStatistic ,
4034}
4135
42- impl Related < super :: event :: Entity > for Entity {
36+ impl Related < super :: physical_expression_to_statistic_junction :: Entity > for Entity {
4337 fn to ( ) -> RelationDef {
44- Relation :: Event . def ( )
38+ Relation :: PhysicalExpressionToStatisticJunction . def ( )
4539 }
4640}
4741
@@ -57,6 +51,12 @@ impl Related<super::table_metadata::Entity> for Entity {
5751 }
5852}
5953
54+ impl Related < super :: versioned_statistic:: Entity > for Entity {
55+ fn to ( ) -> RelationDef {
56+ Relation :: VersionedStatistic . def ( )
57+ }
58+ }
59+
6060impl Related < super :: attribute:: Entity > for Entity {
6161 fn to ( ) -> RelationDef {
6262 super :: statistic_to_attribute_junction:: Relation :: Attribute . def ( )
@@ -70,4 +70,17 @@ impl Related<super::attribute::Entity> for Entity {
7070 }
7171}
7272
73+ impl Related < super :: physical_expression:: Entity > for Entity {
74+ fn to ( ) -> RelationDef {
75+ super :: physical_expression_to_statistic_junction:: Relation :: PhysicalExpression . def ( )
76+ }
77+ fn via ( ) -> Option < RelationDef > {
78+ Some (
79+ super :: physical_expression_to_statistic_junction:: Relation :: Statistic
80+ . def ( )
81+ . rev ( ) ,
82+ )
83+ }
84+ }
85+
7386impl ActiveModelBehavior for ActiveModel { }
0 commit comments