-
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,11 +3,12 @@ package migrations | |
| import ( | ||
| "encoding/json" | ||
| "fmt" | ||
| "github.com/1Panel-dev/1Panel/core/app/dto" | ||
| "path" | ||
| "strings" | ||
| "time" | ||
|
|
||
| "github.com/1Panel-dev/1Panel/core/app/dto" | ||
|
|
||
| "github.com/1Panel-dev/1Panel/core/app/model" | ||
| "github.com/1Panel-dev/1Panel/core/constant" | ||
| "github.com/1Panel-dev/1Panel/core/global" | ||
|
|
@@ -274,16 +275,6 @@ var AddTaskDB = &gormigrate.Migration{ | |
| }, | ||
| } | ||
|
|
||
| var UpdateDeveloperMode = &gormigrate.Migration{ | ||
| ID: "20240516-update-developer-mode", | ||
| Migrate: func(tx *gorm.DB) error { | ||
| if err := tx.Model(&model.Setting{}).Where("key = ?", "DeveloperMode").Update("value", constant.StatusEnable).Error; err != nil { | ||
| return err | ||
| } | ||
| return nil | ||
| }, | ||
| } | ||
|
|
||
| var AddXpackHideMenu = &gormigrate.Migration{ | ||
| ID: "20250529-add-xpack-hide-menu", | ||
| Migrate: func(tx *gorm.DB) error { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 This ensures the code is clean and easier to read while maintaining functionality. |
||
|
|
||
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
UpdateDeveloperModefunction 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.