feat: add location and proxy host entities with migrations

This commit is contained in:
GW_MC
2026-01-07 15:57:13 +08:00
parent 1ed065e08e
commit ab840126b3
10 changed files with 347 additions and 0 deletions

View File

@@ -0,0 +1,48 @@
//! `SeaORM` Entity, @generated by sea-orm-codegen 2.0.0-rc.18
use sea_orm::entity::prelude::*;
use serde::{Deserialize, Serialize};
#[sea_orm::model]
#[derive(Clone, Debug, PartialEq, Eq, DeriveEntityModel, Serialize, Deserialize)]
#[sea_orm(table_name = "proxy_host")]
pub struct Model {
#[sea_orm(primary_key, auto_increment = false)]
pub id: Uuid,
pub name: Option<String>,
pub domain: String,
pub scheme: String,
pub listen_port: i64,
pub forward_scheme: String,
pub forward_host: Option<String>,
pub forward_port: Option<i64>,
pub preserve_host_header: bool,
pub enable_websocket: bool,
pub enabled: bool,
#[sea_orm(column_type = "JsonBinary", nullable)]
pub meta: Option<Json>,
pub default_upstream_id: Option<Uuid>,
pub created_by: Option<Uuid>,
pub created_at: DateTimeUtc,
pub updated_at: DateTimeUtc,
#[sea_orm(has_many)]
pub locations: HasMany<super::location::Entity>,
#[sea_orm(
belongs_to,
from = "default_upstream_id",
to = "id",
on_update = "Cascade",
on_delete = "SetNull"
)]
pub upstream: HasOne<super::upstream::Entity>,
#[sea_orm(
belongs_to,
from = "created_by",
to = "id",
on_update = "Cascade",
on_delete = "SetNull"
)]
pub user: HasOne<super::user::Entity>,
}
impl ActiveModelBehavior for ActiveModel {}