-
Notifications
You must be signed in to change notification settings - Fork 2.9k
fix: Delete the redundant migrations #8968
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Adding the "do-not-merge/release-note-label-needed" label because no release-note block was detected, please follow our release note process to remove it. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
|
|
||
| var AddXpackHideMenu = &gormigrate.Migration{ | ||
| ID: "20250529-add-xpack-hide-menu", | ||
| Migrate: func(tx *gorm.DB) error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There seems to be some redundant imports near the bottom of the file that can cause confusion. Here's an optimized version:
package migrations
import (
"encoding/json"
"fmt"
"path"
"strings"
"time"
dbModel "github.com/1Panel-dev/1Panel/core/app/model"
constant "github.com/1Panel-dev/1Panel/core/constant"
)
var AddTaskDB = &gormigrate.Migration{
ID: "20240516-add-task-db",
Migrate: func(tx *gorm.DB) error {
return dbModel.Task{}.DropTableIfExists().
CreateTables(dbModel.Task{})
},
}
// var UpdateDeveloperMode is unused and can be deleted.Additionally, adding dbModel before each call simplifies the usage since it clearly indicates which package they belong to.
This ensures the code is clean and easier to read while maintaining functionality.
| migrations.UpdateDeveloperMode, | ||
| migrations.AddXpackHideMenu, | ||
| }) | ||
| if err := m.Migrate(); err != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The UpdateDeveloperMode function call should be removed from the migration list unless that functionality is intended to be executed within a specific migration step. This could potentially lead to missing updates if migrations are executed independently.
|
wanghe-fit2cloud
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
|
/approve |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: wanghe-fit2cloud The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |



No description provided.