Skip to content

fix(model): add DisableReportPushConfigInProject for project deletion#3343

Merged
Seechi-Yolo merged 1 commit into
mainfrom
sqle/fix-dms-ee-440
Jun 29, 2026
Merged

fix(model): add DisableReportPushConfigInProject for project deletion#3343
Seechi-Yolo merged 1 commit into
mainfrom
sqle/fix-dms-ee-440

Conversation

@LordofAvernus

@LordofAvernus LordofAvernus commented Jun 29, 2026

Copy link
Copy Markdown
Collaborator

User description

Problem

Deleting a DMS project fails when SQLE report push configs are enabled (default workflow push is enabled on project creation). The delete pre-check blocks deletion instead of stopping push rules automatically.

Solution

Add DisableReportPushConfigInProject storage helper to disable enabled report push configs before project deletion proceeds.

Test plan

  • make EDITION=ce docker_install passes
  • EE-side handler change depends on this CE commit; merge CE PR before EE PR

Fixes actiontech/dms-ee#440


Description

  • 新增 DisableReportPushConfigInProject 方法

  • 禁用启用状态的 report push config

  • 修复项目删除时的阻塞问题


Diagram Walkthrough

flowchart LR
  A["新增DisableReportPushConfigInProject方法"]
  B["更新数据库禁用配置"]
  A -- "调用" --> B
Loading

File Walkthrough

Relevant files
Bug fix
report_push_config.go
新增禁用ReportPushConfig函数                                                                     

sqle/model/report_push_config.go

  • 添加 DisableReportPushConfigInProject 方法
  • 通过数据库更新禁用报表推送配置
+4/-0     

Add a storage helper to disable enabled report push configs before project deletion, so delete flow can stop push rules without blocking.

Fixes actiontech/dms-ee#440
@github-actions

Copy link
Copy Markdown

PR Reviewer Guide 🔍

🎫 Ticket compliance analysis 🔶

440 - Partially compliant

Compliant requirements:

  • 新增 DisableReportPushConfigInProject 方法以禁用 report push 配置
  • 修复删除阻塞问题

Non-compliant requirements:

Requires further human verification:

⏱️ Estimated effort to review: 2 🔵🔵⚪⚪⚪
🧪 PR contains tests
🔒 No security concerns identified
⚡ No major issues detected

@github-actions

Copy link
Copy Markdown

PR Code Suggestions ✨

Explore these optional code suggestions:

CategorySuggestion                                                                                                                                    Impact
Possible issue
检查更新行数返回值

建议在更新操作后检测 RowsAffected 的返回值,确保实际更新了记录。如果未更新记录,应返回适当的错误以避免数据不一致的问题。

sqle/model/report_push_config.go [117-119]

 func (s Storage) DisableReportPushConfigInProject(projectID string) error {
-    return s.db.Model(&ReportPushConfig{}).Where("project_id = ? AND enabled = ?", projectID, true).Update("enabled", false).Error
+    result := s.db.Model(&ReportPushConfig{}).Where("project_id = ? AND enabled = ?", projectID, true).Update("enabled", false)
+    if result.Error != nil {
+        return result.Error
+    }
+    if result.RowsAffected == 0 {
+        return fmt.Errorf("no enabled report push config found for project: %s", projectID)
+    }
+    return nil
 }
Suggestion importance[1-10]: 8

__

Why: The suggestion adds necessary error handling by checking RowsAffected which improves the reliability of the update operation on ReportPushConfig while being appropriate for a database error handling enhancement.

Medium

@Seechi-Yolo Seechi-Yolo merged commit 4c21b20 into main Jun 29, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants