Skip to content

fix: CrossGroupRetry default false - #2570

Merged
seefs001 merged 1 commit into
QuantumNous:mainfrom
feitianbubu:pr/43f64c6508515ffaec308ac9c1cf2afa2de98c3d
Jan 3, 2026
Merged

fix: CrossGroupRetry default false#2570
seefs001 merged 1 commit into
QuantumNous:mainfrom
feitianbubu:pr/43f64c6508515ffaec308ac9c1cf2afa2de98c3d

Conversation

@feitianbubu

@feitianbubu feitianbubu commented Jan 3, 2026

Copy link
Copy Markdown
Member

移除gorm:"default:false",避免每次 AutoMigrate时重复执行
ALTER TABLE tokensMODIFY COLUMNcross_group_retryboolean DEFAULT false
且bool默认false不影响原有功能

Summary by CodeRabbit

Release Notes

  • Chores
    • Updated internal database configuration for token handling.

✏️ Tip: You can customize this high-level summary in your review settings.

移除gorm:"default:false",避免每次 AutoMigrate时都执行ALTER TABLE `tokens` MODIFY COLUMN `cross_group_retry` boolean DEFAULT false
且bool默认false不影响原有功能
@coderabbitai

coderabbitai Bot commented Jan 3, 2026

Copy link
Copy Markdown
Contributor

Walkthrough

The CrossGroupRetry field in the Token struct has had its GORM default tag removed. The field retains its boolean type and JSON tag but no longer specifies a database-level default value constraint in the ORM configuration.

Changes

Cohort / File(s) Summary
GORM Tag Removal
model/token.go
Removed gorm:"default:false" from CrossGroupRetry field tag; field now contains only json:"cross_group_retry" without ORM default directive

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Possibly related PRs

Poem

🐰 A boolean once wore a tag so bright,
"Default to false," it declared with might,
But we've set it free to find its way,
No ORM constraint to make it stay!
Now the zero value rules the day! ✨

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: removing the GORM default constraint from the CrossGroupRetry field, which aligns with the changeset's primary objective of fixing unnecessary ALTER TABLE migrations.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
  • 📝 Generate docstrings

📜 Recent review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 43c671b and c682e41.

📒 Files selected for processing (1)
  • model/token.go
🔇 Additional comments (1)
model/token.go (1)

29-29: LGTM! Removes unnecessary migration overhead.

The change correctly removes the GORM default tag to prevent repeated ALTER TABLE operations on every AutoMigrate. Since Go's zero value for bool is false, the behavior remains identical for all GORM operations (Insert/Update). The codebase contains no direct SQL INSERT statements that would rely on database-level defaults for this field—all usage of CrossGroupRetry is through GORM operations and Go context management.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@seefs001
seefs001 merged commit 1f78c6a into QuantumNous:main Jan 3, 2026
1 check passed
ennnnny pushed a commit to ennnnny/new-api that referenced this pull request Mar 17, 2026
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