1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
| -- ============================================================
| -- 不合格管理模块优化
| -- 1. 废弃 quality_inspect_file 表,附件改用 storage_attachment 体系
| -- 2. 检验记录附件通过 storage_attachment (record_type='quality_inspect') 关联
| -- 3. 不合格品附件通过 storage_attachment (record_type='quality_unqualified') 关联
| -- 生成日期:2026-06-13
| -- ============================================================
|
| -- 可选:如果 quality_inspect_file 表存在且有数据,需要先迁移数据再删除
| -- 数据迁移(将旧附件数据迁移到 storage_attachment 表)
| -- INSERT INTO storage_attachment (name, url, file_size, application, record_type, record_id, create_time, create_user, tenant_id, dept_id, is_deleted)
| -- SELECT name, url, file_size, 'FILE', 'quality_inspect', inspect_id, create_time, create_user, tenant_id, dept_id, 0
| -- FROM quality_inspect_file;
|
| -- 删除旧的检验附件表(确认数据已迁移后执行)
| -- DROP TABLE IF EXISTS quality_inspect_file;
|
|