HIGH: - wechat_users 迁移补充 created_by/updated_by/version 标准字段 - Entity 同步更新,bind_phone 创建记录时填充新字段 - appointment create 移除 schedule_id 空字符串,改为可选 - appointment list 用 useRef 替代 useCallback 的 loading 依赖,消除 stale closure MEDIUM: - report 页 patientId 从顶层读取改为 useDidShow 内动态获取,就诊人切换后正确刷新 - profile/reports 同上修复 - profile/followups 移除 useDidShow 非法的第二参数
82 lines
2.7 KiB
Rust
82 lines
2.7 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(WechatUsers::Table)
|
|
.if_not_exists()
|
|
.col(ColumnDef::new(WechatUsers::Id).uuid().not_null().primary_key())
|
|
.col(ColumnDef::new(WechatUsers::TenantId).uuid().not_null())
|
|
.col(ColumnDef::new(WechatUsers::Openid).string().not_null())
|
|
.col(ColumnDef::new(WechatUsers::UnionId).string())
|
|
.col(ColumnDef::new(WechatUsers::UserId).uuid().not_null())
|
|
.col(ColumnDef::new(WechatUsers::Phone).string())
|
|
.col(
|
|
ColumnDef::new(WechatUsers::CreatedAt)
|
|
.timestamp_with_time_zone()
|
|
.not_null()
|
|
.default(Expr::current_timestamp()),
|
|
)
|
|
.col(
|
|
ColumnDef::new(WechatUsers::UpdatedAt)
|
|
.timestamp_with_time_zone()
|
|
.not_null()
|
|
.default(Expr::current_timestamp()),
|
|
)
|
|
.col(ColumnDef::new(WechatUsers::CreatedBy).uuid())
|
|
.col(ColumnDef::new(WechatUsers::UpdatedBy).uuid())
|
|
.col(
|
|
ColumnDef::new(WechatUsers::DeletedAt)
|
|
.timestamp_with_time_zone(),
|
|
)
|
|
.col(ColumnDef::new(WechatUsers::Version).integer().not_null().default(1))
|
|
.to_owned(),
|
|
)
|
|
.await?;
|
|
|
|
manager
|
|
.create_index(
|
|
Index::create()
|
|
.name("idx_wechat_users_openid")
|
|
.table(WechatUsers::Table)
|
|
.col(WechatUsers::Openid)
|
|
.col(WechatUsers::TenantId)
|
|
.unique()
|
|
.to_owned(),
|
|
)
|
|
.await
|
|
}
|
|
|
|
async fn down(&self, manager: &SchemaManager) -> Result<(), DbErr> {
|
|
manager
|
|
.drop_index(Index::drop().name("idx_wechat_users_openid").to_owned())
|
|
.await?;
|
|
manager
|
|
.drop_table(Table::drop().table(WechatUsers::Table).to_owned())
|
|
.await
|
|
}
|
|
}
|
|
|
|
#[derive(DeriveIden)]
|
|
enum WechatUsers {
|
|
Table,
|
|
Id,
|
|
TenantId,
|
|
Openid,
|
|
UnionId,
|
|
UserId,
|
|
Phone,
|
|
CreatedAt,
|
|
UpdatedAt,
|
|
DeletedAt,
|
|
CreatedBy,
|
|
UpdatedBy,
|
|
Version,
|
|
}
|