Skip to content

Commit b15b4a7

Browse files
committed
add migration and entity files
1 parent 7832362 commit b15b4a7

14 files changed

+743
-0
lines changed
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
//! `SeaORM` Entity, @generated by sea-orm-codegen 1.1.0
2+
3+
use sea_orm::entity::prelude::*;
4+
5+
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq)]
6+
#[sea_orm(table_name = "cascades_group")]
7+
pub struct Model {
8+
#[sea_orm(primary_key)]
9+
pub id: i32,
10+
pub winner: Option<i32>,
11+
pub cost: Option<i64>,
12+
pub is_optimized: bool,
13+
pub parent_id: Option<i32>,
14+
}
15+
16+
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
17+
pub enum Relation {
18+
#[sea_orm(
19+
belongs_to = "Entity",
20+
from = "Column::ParentId",
21+
to = "Column::Id",
22+
on_update = "Cascade",
23+
on_delete = "SetNull"
24+
)]
25+
SelfRef,
26+
#[sea_orm(has_many = "super::logical_children::Entity")]
27+
LogicalChildren,
28+
#[sea_orm(has_many = "super::logical_expression::Entity")]
29+
LogicalExpression,
30+
#[sea_orm(has_many = "super::physical_children::Entity")]
31+
PhysicalChildren,
32+
#[sea_orm(
33+
belongs_to = "super::physical_expression::Entity",
34+
from = "Column::Winner",
35+
to = "super::physical_expression::Column::Id",
36+
on_update = "Cascade",
37+
on_delete = "SetNull"
38+
)]
39+
PhysicalExpression,
40+
}
41+
42+
impl Related<super::logical_children::Entity> for Entity {
43+
fn to() -> RelationDef {
44+
Relation::LogicalChildren.def()
45+
}
46+
}
47+
48+
impl Related<super::physical_children::Entity> for Entity {
49+
fn to() -> RelationDef {
50+
Relation::PhysicalChildren.def()
51+
}
52+
}
53+
54+
impl Related<super::logical_expression::Entity> for Entity {
55+
fn to() -> RelationDef {
56+
super::logical_children::Relation::LogicalExpression.def()
57+
}
58+
fn via() -> Option<RelationDef> {
59+
Some(super::logical_children::Relation::CascadesGroup.def().rev())
60+
}
61+
}
62+
63+
impl Related<super::physical_expression::Entity> for Entity {
64+
fn to() -> RelationDef {
65+
super::physical_children::Relation::PhysicalExpression.def()
66+
}
67+
fn via() -> Option<RelationDef> {
68+
Some(
69+
super::physical_children::Relation::CascadesGroup
70+
.def()
71+
.rev(),
72+
)
73+
}
74+
}
75+
76+
impl ActiveModelBehavior for ActiveModel {}
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
//! `SeaORM` Entity, @generated by sea-orm-codegen 1.1.0
2+
3+
use sea_orm::entity::prelude::*;
4+
5+
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq)]
6+
#[sea_orm(table_name = "logical_children")]
7+
pub struct Model {
8+
#[sea_orm(primary_key, auto_increment = false)]
9+
pub logical_expression_id: i32,
10+
#[sea_orm(primary_key, auto_increment = false)]
11+
pub group_id: i32,
12+
}
13+
14+
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
15+
pub enum Relation {
16+
#[sea_orm(
17+
belongs_to = "super::cascades_group::Entity",
18+
from = "Column::GroupId",
19+
to = "super::cascades_group::Column::Id",
20+
on_update = "Cascade",
21+
on_delete = "Cascade"
22+
)]
23+
CascadesGroup,
24+
#[sea_orm(
25+
belongs_to = "super::logical_expression::Entity",
26+
from = "Column::GroupId",
27+
to = "super::logical_expression::Column::Id",
28+
on_update = "Cascade",
29+
on_delete = "Cascade"
30+
)]
31+
LogicalExpression,
32+
}
33+
34+
impl Related<super::cascades_group::Entity> for Entity {
35+
fn to() -> RelationDef {
36+
Relation::CascadesGroup.def()
37+
}
38+
}
39+
40+
impl Related<super::logical_expression::Entity> for Entity {
41+
fn to() -> RelationDef {
42+
Relation::LogicalExpression.def()
43+
}
44+
}
45+
46+
impl ActiveModelBehavior for ActiveModel {}
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
//! `SeaORM` Entity, @generated by sea-orm-codegen 1.1.0
2+
3+
use sea_orm::entity::prelude::*;
4+
5+
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq)]
6+
#[sea_orm(table_name = "logical_expression")]
7+
pub struct Model {
8+
#[sea_orm(primary_key)]
9+
pub id: i32,
10+
pub group_id: i32,
11+
pub fingerprint: i64,
12+
pub kind: i16,
13+
pub data: Json,
14+
}
15+
16+
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
17+
pub enum Relation {
18+
#[sea_orm(
19+
belongs_to = "super::cascades_group::Entity",
20+
from = "Column::GroupId",
21+
to = "super::cascades_group::Column::Id",
22+
on_update = "Cascade",
23+
on_delete = "Cascade"
24+
)]
25+
CascadesGroup,
26+
#[sea_orm(has_many = "super::logical_children::Entity")]
27+
LogicalChildren,
28+
}
29+
30+
impl Related<super::logical_children::Entity> for Entity {
31+
fn to() -> RelationDef {
32+
Relation::LogicalChildren.def()
33+
}
34+
}
35+
36+
impl Related<super::cascades_group::Entity> for Entity {
37+
fn to() -> RelationDef {
38+
super::logical_children::Relation::CascadesGroup.def()
39+
}
40+
fn via() -> Option<RelationDef> {
41+
Some(
42+
super::logical_children::Relation::LogicalExpression
43+
.def()
44+
.rev(),
45+
)
46+
}
47+
}
48+
49+
impl ActiveModelBehavior for ActiveModel {}

optd-mvp/src/entities/mod.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
//! `SeaORM` Entity, @generated by sea-orm-codegen 1.1.0
2+
3+
pub mod prelude;
4+
5+
pub mod cascades_group;
6+
pub mod logical_children;
7+
pub mod logical_expression;
8+
pub mod physical_children;
9+
pub mod physical_expression;
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
//! `SeaORM` Entity, @generated by sea-orm-codegen 1.1.0
2+
3+
use sea_orm::entity::prelude::*;
4+
5+
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq)]
6+
#[sea_orm(table_name = "physical_children")]
7+
pub struct Model {
8+
#[sea_orm(primary_key, auto_increment = false)]
9+
pub physical_expression_id: i32,
10+
#[sea_orm(primary_key, auto_increment = false)]
11+
pub group_id: i32,
12+
}
13+
14+
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
15+
pub enum Relation {
16+
#[sea_orm(
17+
belongs_to = "super::cascades_group::Entity",
18+
from = "Column::GroupId",
19+
to = "super::cascades_group::Column::Id",
20+
on_update = "Cascade",
21+
on_delete = "Cascade"
22+
)]
23+
CascadesGroup,
24+
#[sea_orm(
25+
belongs_to = "super::physical_expression::Entity",
26+
from = "Column::PhysicalExpressionId",
27+
to = "super::physical_expression::Column::Id",
28+
on_update = "Cascade",
29+
on_delete = "Cascade"
30+
)]
31+
PhysicalExpression,
32+
}
33+
34+
impl Related<super::cascades_group::Entity> for Entity {
35+
fn to() -> RelationDef {
36+
Relation::CascadesGroup.def()
37+
}
38+
}
39+
40+
impl Related<super::physical_expression::Entity> for Entity {
41+
fn to() -> RelationDef {
42+
Relation::PhysicalExpression.def()
43+
}
44+
}
45+
46+
impl ActiveModelBehavior for ActiveModel {}
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
//! `SeaORM` Entity, @generated by sea-orm-codegen 1.1.0
2+
3+
use sea_orm::entity::prelude::*;
4+
5+
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq)]
6+
#[sea_orm(table_name = "physical_expression")]
7+
pub struct Model {
8+
#[sea_orm(primary_key)]
9+
pub id: i32,
10+
pub group_id: i32,
11+
pub fingerprint: i64,
12+
pub kind: i16,
13+
pub data: Json,
14+
}
15+
16+
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
17+
pub enum Relation {
18+
#[sea_orm(
19+
belongs_to = "super::cascades_group::Entity",
20+
from = "Column::GroupId",
21+
to = "super::cascades_group::Column::Id",
22+
on_update = "Cascade",
23+
on_delete = "Cascade"
24+
)]
25+
CascadesGroup,
26+
#[sea_orm(has_many = "super::physical_children::Entity")]
27+
PhysicalChildren,
28+
}
29+
30+
impl Related<super::physical_children::Entity> for Entity {
31+
fn to() -> RelationDef {
32+
Relation::PhysicalChildren.def()
33+
}
34+
}
35+
36+
impl Related<super::cascades_group::Entity> for Entity {
37+
fn to() -> RelationDef {
38+
super::physical_children::Relation::CascadesGroup.def()
39+
}
40+
fn via() -> Option<RelationDef> {
41+
Some(
42+
super::physical_children::Relation::PhysicalExpression
43+
.def()
44+
.rev(),
45+
)
46+
}
47+
}
48+
49+
impl ActiveModelBehavior for ActiveModel {}

optd-mvp/src/entities/prelude.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
//! `SeaORM` Entity, @generated by sea-orm-codegen 1.1.0
2+
3+
#![allow(unused_imports)]
4+
5+
pub use super::cascades_group::Entity as CascadesGroup;
6+
pub use super::logical_children::Entity as LogicalChildren;
7+
pub use super::logical_expression::Entity as LogicalExpression;
8+
pub use super::physical_children::Entity as PhysicalChildren;
9+
pub use super::physical_expression::Entity as PhysicalExpression;

0 commit comments

Comments
 (0)