Skip to content

Commit 509f566

Browse files
committed
add migration and entity files
1 parent 67b5ae8 commit 509f566

14 files changed

+739
-0
lines changed
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
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 is_optimized: bool,
12+
pub parent_id: Option<i32>,
13+
}
14+
15+
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
16+
pub enum Relation {
17+
#[sea_orm(
18+
belongs_to = "Entity",
19+
from = "Column::ParentId",
20+
to = "Column::Id",
21+
on_update = "Cascade",
22+
on_delete = "SetNull"
23+
)]
24+
SelfRef,
25+
#[sea_orm(has_many = "super::logical_children::Entity")]
26+
LogicalChildren,
27+
#[sea_orm(has_many = "super::logical_expression::Entity")]
28+
LogicalExpression,
29+
#[sea_orm(has_many = "super::physical_children::Entity")]
30+
PhysicalChildren,
31+
#[sea_orm(
32+
belongs_to = "super::physical_expression::Entity",
33+
from = "Column::Winner",
34+
to = "super::physical_expression::Column::Id",
35+
on_update = "Cascade",
36+
on_delete = "SetNull"
37+
)]
38+
PhysicalExpression,
39+
}
40+
41+
impl Related<super::logical_children::Entity> for Entity {
42+
fn to() -> RelationDef {
43+
Relation::LogicalChildren.def()
44+
}
45+
}
46+
47+
impl Related<super::physical_children::Entity> for Entity {
48+
fn to() -> RelationDef {
49+
Relation::PhysicalChildren.def()
50+
}
51+
}
52+
53+
impl Related<super::logical_expression::Entity> for Entity {
54+
fn to() -> RelationDef {
55+
super::logical_children::Relation::LogicalExpression.def()
56+
}
57+
fn via() -> Option<RelationDef> {
58+
Some(super::logical_children::Relation::CascadesGroup.def().rev())
59+
}
60+
}
61+
62+
impl Related<super::physical_expression::Entity> for Entity {
63+
fn to() -> RelationDef {
64+
super::physical_children::Relation::PhysicalExpression.def()
65+
}
66+
fn via() -> Option<RelationDef> {
67+
Some(
68+
super::physical_children::Relation::CascadesGroup
69+
.def()
70+
.rev(),
71+
)
72+
}
73+
}
74+
75+
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: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
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+
}
14+
15+
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
16+
pub enum Relation {
17+
#[sea_orm(
18+
belongs_to = "super::cascades_group::Entity",
19+
from = "Column::GroupId",
20+
to = "super::cascades_group::Column::Id",
21+
on_update = "Cascade",
22+
on_delete = "Cascade"
23+
)]
24+
CascadesGroup,
25+
#[sea_orm(has_many = "super::physical_children::Entity")]
26+
PhysicalChildren,
27+
}
28+
29+
impl Related<super::physical_children::Entity> for Entity {
30+
fn to() -> RelationDef {
31+
Relation::PhysicalChildren.def()
32+
}
33+
}
34+
35+
impl Related<super::cascades_group::Entity> for Entity {
36+
fn to() -> RelationDef {
37+
super::physical_children::Relation::CascadesGroup.def()
38+
}
39+
fn via() -> Option<RelationDef> {
40+
Some(
41+
super::physical_children::Relation::PhysicalExpression
42+
.def()
43+
.rev(),
44+
)
45+
}
46+
}
47+
48+
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)