mirror of
https://github.com/Rain-kl/OpenFlare.git
synced 2026-10-08 16:46:37 +08:00
[优化] 修复一个升级数据库的错误
This commit is contained in:
@@ -204,6 +204,12 @@ func dropLegacyNodeColumns(db *gorm.DB, backend string) error {
|
||||
if db == nil || !db.Migrator().HasTable(&Node{}) {
|
||||
return nil
|
||||
}
|
||||
// Drop the legacy index idx_nodes_agent_token if it exists, to avoid errors on dropping the agent_token column (especially on SQLite).
|
||||
if db.Migrator().HasIndex(&Node{}, "idx_nodes_agent_token") {
|
||||
if err := db.Migrator().DropIndex(&Node{}, "idx_nodes_agent_token"); err != nil {
|
||||
return fmt.Errorf("drop index idx_nodes_agent_token failed: %w", err)
|
||||
}
|
||||
}
|
||||
legacyColumns := []struct {
|
||||
column string
|
||||
}{
|
||||
|
||||
Reference in New Issue
Block a user