- Introduced `log_setting`, `proxy_config`, `proxy_setting`, `rewrite_rule`, `server_block`, `ssl_certificate`, and `upstream` entities with their respective fields and relationships. - Updated `mod.rs` and `prelude.rs` to include new entities. - Created migration script to set up new tables and relationships in the database. - Altered existing `agents` table to include a foreign key reference to `agent_group`.
92 lines
2.4 KiB
Rust
92 lines
2.4 KiB
Rust
//! `SeaORM` Entity, @generated by sea-orm-codegen 2.0
|
|
|
|
use sea_orm::entity::prelude::*;
|
|
use serde::{Deserialize, Serialize};
|
|
|
|
#[derive(Clone, Debug, PartialEq, Eq, DeriveEntityModel, Serialize, Deserialize)]
|
|
#[sea_orm(table_name = "location_block")]
|
|
pub struct Model {
|
|
#[sea_orm(primary_key, auto_increment = false)]
|
|
pub id: Uuid,
|
|
pub server_id: Uuid,
|
|
pub path_pattern: String,
|
|
pub proxy_pass_upstream_id: Option<Uuid>,
|
|
#[sea_orm(column_type = "JsonBinary", nullable)]
|
|
pub metadata: Option<Json>,
|
|
pub override_of_id: Option<Uuid>,
|
|
}
|
|
|
|
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
|
|
pub enum Relation {
|
|
#[sea_orm(has_many = "super::access_rule::Entity")]
|
|
AccessRule,
|
|
#[sea_orm(has_many = "super::limit_rule::Entity")]
|
|
LimitRule,
|
|
#[sea_orm(
|
|
belongs_to = "Entity",
|
|
from = "Column::OverrideOfId",
|
|
to = "Column::Id",
|
|
on_update = "Cascade",
|
|
on_delete = "SetNull"
|
|
)]
|
|
SelfRef,
|
|
#[sea_orm(has_many = "super::proxy_setting::Entity")]
|
|
ProxySetting,
|
|
#[sea_orm(has_many = "super::rewrite_rule::Entity")]
|
|
RewriteRule,
|
|
#[sea_orm(
|
|
belongs_to = "super::server_block::Entity",
|
|
from = "Column::ServerId",
|
|
to = "super::server_block::Column::Id",
|
|
on_update = "Cascade",
|
|
on_delete = "Cascade"
|
|
)]
|
|
ServerBlock,
|
|
#[sea_orm(
|
|
belongs_to = "super::upstream::Entity",
|
|
from = "Column::ProxyPassUpstreamId",
|
|
to = "super::upstream::Column::Id",
|
|
on_update = "Cascade",
|
|
on_delete = "SetNull"
|
|
)]
|
|
Upstream,
|
|
}
|
|
|
|
impl Related<super::access_rule::Entity> for Entity {
|
|
fn to() -> RelationDef {
|
|
Relation::AccessRule.def()
|
|
}
|
|
}
|
|
|
|
impl Related<super::limit_rule::Entity> for Entity {
|
|
fn to() -> RelationDef {
|
|
Relation::LimitRule.def()
|
|
}
|
|
}
|
|
|
|
impl Related<super::proxy_setting::Entity> for Entity {
|
|
fn to() -> RelationDef {
|
|
Relation::ProxySetting.def()
|
|
}
|
|
}
|
|
|
|
impl Related<super::rewrite_rule::Entity> for Entity {
|
|
fn to() -> RelationDef {
|
|
Relation::RewriteRule.def()
|
|
}
|
|
}
|
|
|
|
impl Related<super::server_block::Entity> for Entity {
|
|
fn to() -> RelationDef {
|
|
Relation::ServerBlock.def()
|
|
}
|
|
}
|
|
|
|
impl Related<super::upstream::Entity> for Entity {
|
|
fn to() -> RelationDef {
|
|
Relation::Upstream.def()
|
|
}
|
|
}
|
|
|
|
impl ActiveModelBehavior for ActiveModel {}
|