feat(health): patient entity PII 伴生字段 + content_management 编译修复
- 迁移 m000064: patient 添加 emergency_contact_phone_hash + key_version - patient Entity 补充对应字段 - 修复 content_management 迁移: exec_stmt → execute_unprepared - 修复 article_service: 补全新字段 (status/slug/content_type 等) - 修复 article_article_tag: 复合主键注解
This commit is contained in:
@@ -61,6 +61,9 @@ mod m20260426_000058_merge_daily_monitoring_into_vital_signs;
|
||||
mod m20260426_000059_seed_menus;
|
||||
mod m20260426_000060_create_critical_value_thresholds;
|
||||
mod m20260426_000061_create_consent;
|
||||
mod m20260427_000062_create_tenant_crypto_keys;
|
||||
mod m20260427_000063_content_management;
|
||||
mod m20260427_000064_add_patient_pii_fields;
|
||||
|
||||
pub struct Migrator;
|
||||
|
||||
@@ -129,6 +132,9 @@ impl MigratorTrait for Migrator {
|
||||
Box::new(m20260426_000059_seed_menus::Migration),
|
||||
Box::new(m20260426_000060_create_critical_value_thresholds::Migration),
|
||||
Box::new(m20260426_000061_create_consent::Migration),
|
||||
Box::new(m20260427_000062_create_tenant_crypto_keys::Migration),
|
||||
Box::new(m20260427_000063_content_management::Migration),
|
||||
Box::new(m20260427_000064_add_patient_pii_fields::Migration),
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
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
|
||||
.alter_table(
|
||||
Table::alter()
|
||||
.table(Patient::Table)
|
||||
.add_column(ColumnDef::new(Patient::EmergencyContactPhoneHash).string_len(64).null())
|
||||
.add_column(ColumnDef::new(Patient::KeyVersion).integer().null())
|
||||
.to_owned(),
|
||||
)
|
||||
.await?;
|
||||
|
||||
manager
|
||||
.create_index(
|
||||
Index::create()
|
||||
.name("idx_patient_emergency_phone_hash")
|
||||
.table(Patient::Table)
|
||||
.col(Patient::EmergencyContactPhoneHash)
|
||||
.to_owned(),
|
||||
)
|
||||
.await?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
async fn down(&self, manager: &SchemaManager) -> Result<(), DbErr> {
|
||||
manager
|
||||
.drop_index(Index::drop().name("idx_patient_emergency_phone_hash").to_owned())
|
||||
.await?;
|
||||
|
||||
manager
|
||||
.alter_table(
|
||||
Table::alter()
|
||||
.table(Patient::Table)
|
||||
.drop_column(Patient::EmergencyContactPhoneHash)
|
||||
.drop_column(Patient::KeyVersion)
|
||||
.to_owned(),
|
||||
)
|
||||
.await?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(DeriveIden)]
|
||||
enum Patient {
|
||||
Table,
|
||||
EmergencyContactPhoneHash,
|
||||
KeyVersion,
|
||||
}
|
||||
Reference in New Issue
Block a user