| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677 |
- namespace Admin.NET.Plugin.AiDOP.Entity.S6;
- /// <summary>
- /// S6-LEGACY-SNAPSHOT-MIGRATION-1:S6 存量运行中实例的审批权威快照迁移留证。
- ///
- /// <para><b>为什么必须留证</b>:<c>ApprovalFlowInstance</c> 没有 version、没有 checksum、
- /// 没有并发令牌,<c>UpdateTime</c> 也不是 DB 自动列 —— 裸 UPDATE 之后
- /// <b>无法证明改过什么、为什么改、改前是什么</b>。而 <c>FlowJsonSnapshot</c> 同时是
- /// 通用审批中心渲染历史流程图的数据源(<c>FlowInstanceService</c> 对外暴露 →
- /// 前端 <c>center/index.vue</c> 与 <c>ApprovalPanel.vue</c> 消费)。
- /// 没有这张表,这就是一次无法解释的静默改写。</para>
- ///
- /// <para><b>与 <c>AdoS8ApprovalFlowRepairLog</c> 的关键差异:本表 append-only。</b>
- /// S8 那张表每轮 <c>DELETE FROM ... WHERE true</c> 后整体重写(它描述的是「最近一次对账看到了什么」),
- /// 迁移留证不能是这种语义 —— 迁移是**一次性历史事件**,记录一旦写下就不允许被后续运行抹掉,
- /// 否则回滚依据会随时间消失。故本表独立建立,不复用 S8 那张。</para>
- ///
- /// <para><b>幂等不依赖本表。</b>「是否已迁」的判据是快照自身内容(Role 节点的 approverIds
- /// 是否还存在纯数字 token),不是「本表里有没有这条 InstanceId」——
- /// 留证一旦丢失就重复改写,是 S8 先例踩过的坑。</para>
- /// </summary>
- [SugarTable("ado_s6_flow_authority_migration_log", "S6 存量流程审批权威迁移留证(append-only)")]
- public class AdoS6FlowAuthorityMigrationLog
- {
- [SugarColumn(ColumnName = "id", IsPrimaryKey = true, IsIdentity = true, ColumnDataType = "bigint")]
- public long Id { get; set; }
- /// <summary>迁移批次标识,同一次执行的所有记录共用,便于整批回滚定位。</summary>
- [SugarColumn(ColumnName = "migration_batch", Length = 64)]
- public string MigrationBatch { get; set; } = string.Empty;
- [SugarColumn(ColumnName = "instance_id", ColumnDataType = "bigint")]
- public long InstanceId { get; set; }
- [SugarColumn(ColumnName = "biz_type", Length = 64)]
- public string BizType { get; set; } = string.Empty;
- [SugarColumn(ColumnName = "biz_id", ColumnDataType = "bigint")]
- public long BizId { get; set; }
- /// <summary>由业务实体反查得到,**不取登录用户租户**(实例表自身无 TenantId 列)。</summary>
- [SugarColumn(ColumnName = "effective_tenant_id", ColumnDataType = "bigint")]
- public long EffectiveTenantId { get; set; }
- /// <summary>改前快照全文,逐字保留 —— 第一回滚来源。</summary>
- [SugarColumn(ColumnName = "before_snapshot", ColumnDataType = StaticConfig.CodeFirst_BigString, IsNullable = true)]
- public string? BeforeSnapshot { get; set; }
- /// <summary>改后快照全文。回滚前用它比对「现值确实是我改成的那样」。</summary>
- [SugarColumn(ColumnName = "after_snapshot", ColumnDataType = StaticConfig.CodeFirst_BigString, IsNullable = true)]
- public string? AfterSnapshot { get; set; }
- [SugarColumn(ColumnName = "before_md5", Length = 32, IsNullable = true)]
- public string? BeforeMd5 { get; set; }
- [SugarColumn(ColumnName = "after_md5", Length = 32, IsNullable = true)]
- public string? AfterMd5 { get; set; }
- /// <summary>逐节点映射:<c>node=N2_SUP_REVIEW;1329916010002=>ROLE_S6_IPQC_SUPERVISOR@848643233415237</c>。</summary>
- [SugarColumn(ColumnName = "authority_mapping", ColumnDataType = StaticConfig.CodeFirst_BigString, IsNullable = true)]
- public string? AuthorityMapping { get; set; }
- /// <summary>第二回滚来源:可反查出原始 FlowJson 的 ApprovalFlowVersion 行 Id。</summary>
- [SugarColumn(ColumnName = "rollback_source", Length = 128, IsNullable = true)]
- public string? RollbackSource { get; set; }
- /// <summary>为什么改 / 为什么没改:判据与依据。</summary>
- [SugarColumn(ColumnName = "reason", Length = 1024, IsNullable = true)]
- public string? Reason { get; set; }
- /// <summary>APPLIED / SKIPPED_ALREADY_MIGRATED / BLOCKED_TARGET_AUTHORITY / BLOCKED_ROLLBACK_SOURCE / BLOCKED_CONCURRENT_MODIFICATION。</summary>
- [SugarColumn(ColumnName = "outcome", Length = 48)]
- public string Outcome { get; set; } = string.Empty;
- [SugarColumn(ColumnName = "created_at")]
- public DateTime CreatedAt { get; set; } = DateTime.Now;
- }
|