删除内容: - 前端: health/(67文件), ai/(2文件), Copilot, MediaPicker, 相关API/Store/Hook - 后端: wechat_handler, wechat_service, wechat_user entity, analytics handler, ai_workflow_seed - 配置: WechatConfig, AppConfig.wechat, AuthState wechat 字段 - 启动: 微信凭据检查块, ensure_ai_workflows() 调用 - 迁移: 新增 m20260613_000170_drop_wechat_users.rs - 脚本: api_test_health_alert.py, api_test_mp.py, mpsync.sh/ps1 - E2E: health-data page, flows/ 目录 保留: erp-core/auth/workflow/message/config/plugin + 基座前端 + 通用组件
125 lines
4.0 KiB
Rust
125 lines
4.0 KiB
Rust
use sea_orm_migration::prelude::*;
|
|
|
|
#[derive(DeriveMigrationName)]
|
|
pub struct Migration;
|
|
|
|
#[async_trait::async_trait]
|
|
impl MigrationTrait for Migration {
|
|
async fn up(&self, manager: &SchemaManager) -> Result<(), DbErr> {
|
|
manager
|
|
.create_table(
|
|
Table::create()
|
|
.table(Menus::Table)
|
|
.if_not_exists()
|
|
.col(ColumnDef::new(Menus::Id).uuid().not_null().primary_key())
|
|
.col(ColumnDef::new(Menus::TenantId).uuid().not_null())
|
|
.col(ColumnDef::new(Menus::ParentId).uuid().null())
|
|
.col(ColumnDef::new(Menus::Title).string().not_null())
|
|
.col(ColumnDef::new(Menus::Path).string().null())
|
|
.col(ColumnDef::new(Menus::Icon).string().null())
|
|
.col(
|
|
ColumnDef::new(Menus::SortOrder)
|
|
.integer()
|
|
.not_null()
|
|
.default(0),
|
|
)
|
|
.col(
|
|
ColumnDef::new(Menus::Visible)
|
|
.boolean()
|
|
.not_null()
|
|
.default(true),
|
|
)
|
|
.col(
|
|
ColumnDef::new(Menus::MenuType)
|
|
.string()
|
|
.not_null()
|
|
.default("page"),
|
|
)
|
|
.col(ColumnDef::new(Menus::Permission).string().null())
|
|
.col(
|
|
ColumnDef::new(Menus::CreatedAt)
|
|
.timestamp_with_time_zone()
|
|
.not_null()
|
|
.default(Expr::current_timestamp()),
|
|
)
|
|
.col(
|
|
ColumnDef::new(Menus::UpdatedAt)
|
|
.timestamp_with_time_zone()
|
|
.not_null()
|
|
.default(Expr::current_timestamp()),
|
|
)
|
|
.col(ColumnDef::new(Menus::CreatedBy).uuid().not_null())
|
|
.col(ColumnDef::new(Menus::UpdatedBy).uuid().not_null())
|
|
.col(
|
|
ColumnDef::new(Menus::DeletedAt)
|
|
.timestamp_with_time_zone()
|
|
.null(),
|
|
)
|
|
.col(
|
|
ColumnDef::new(Menus::Version)
|
|
.integer()
|
|
.not_null()
|
|
.default(1),
|
|
)
|
|
.foreign_key(
|
|
ForeignKey::create()
|
|
.name("fk_menus_parent")
|
|
.from(Menus::Table, Menus::ParentId)
|
|
.to(Menus::Table, Menus::Id)
|
|
.on_delete(ForeignKeyAction::Cascade),
|
|
)
|
|
.to_owned(),
|
|
)
|
|
.await?;
|
|
|
|
manager
|
|
.create_index(
|
|
Index::create()
|
|
.name("idx_menus_tenant_id")
|
|
.table(Menus::Table)
|
|
.col(Menus::TenantId)
|
|
.to_owned(),
|
|
)
|
|
.await?;
|
|
|
|
manager
|
|
.create_index(
|
|
Index::create()
|
|
.name("idx_menus_parent_id")
|
|
.table(Menus::Table)
|
|
.col(Menus::ParentId)
|
|
.to_owned(),
|
|
)
|
|
.await?;
|
|
|
|
Ok(())
|
|
}
|
|
|
|
async fn down(&self, manager: &SchemaManager) -> Result<(), DbErr> {
|
|
manager
|
|
.drop_table(Table::drop().table(Menus::Table).to_owned())
|
|
.await
|
|
}
|
|
}
|
|
|
|
#[derive(DeriveIden)]
|
|
enum Menus {
|
|
Table,
|
|
Id,
|
|
TenantId,
|
|
ParentId,
|
|
Title,
|
|
Path,
|
|
Icon,
|
|
SortOrder,
|
|
Visible,
|
|
MenuType,
|
|
Permission,
|
|
CreatedAt,
|
|
UpdatedAt,
|
|
CreatedBy,
|
|
UpdatedBy,
|
|
DeletedAt,
|
|
Version,
|
|
}
|