feat: add new database entities and migration for proxy configuration
- 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`.
This commit is contained in:
54
apps/nxmesh-master/src/db/entities/upstream.rs
Normal file
54
apps/nxmesh-master/src/db/entities/upstream.rs
Normal file
@@ -0,0 +1,54 @@
|
||||
//! `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 = "upstream")]
|
||||
pub struct Model {
|
||||
#[sea_orm(primary_key, auto_increment = false)]
|
||||
pub id: Uuid,
|
||||
pub config_id: Uuid,
|
||||
pub name: String,
|
||||
pub target_host: String,
|
||||
pub target_port: i32,
|
||||
#[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::location_block::Entity")]
|
||||
LocationBlock,
|
||||
#[sea_orm(
|
||||
belongs_to = "super::proxy_config::Entity",
|
||||
from = "Column::ConfigId",
|
||||
to = "super::proxy_config::Column::Id",
|
||||
on_update = "Cascade",
|
||||
on_delete = "Cascade"
|
||||
)]
|
||||
ProxyConfig,
|
||||
#[sea_orm(
|
||||
belongs_to = "Entity",
|
||||
from = "Column::OverrideOfId",
|
||||
to = "Column::Id",
|
||||
on_update = "Cascade",
|
||||
on_delete = "SetNull"
|
||||
)]
|
||||
SelfRef,
|
||||
}
|
||||
|
||||
impl Related<super::location_block::Entity> for Entity {
|
||||
fn to() -> RelationDef {
|
||||
Relation::LocationBlock.def()
|
||||
}
|
||||
}
|
||||
|
||||
impl Related<super::proxy_config::Entity> for Entity {
|
||||
fn to() -> RelationDef {
|
||||
Relation::ProxyConfig.def()
|
||||
}
|
||||
}
|
||||
|
||||
impl ActiveModelBehavior for ActiveModel {}
|
||||
Reference in New Issue
Block a user