Skip to content

Commit

Permalink
clean up changes
Browse files Browse the repository at this point in the history
  • Loading branch information
alireza0 committed Jan 19, 2025
1 parent 891a61a commit 049cfc5
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
12 changes: 10 additions & 2 deletions backend/cmd/migration/1_2.go
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ func migrateTls(db *gorm.DB) error {
if err != nil {
continue
}
for key, _ := range tlsClient {
for key := range tlsClient {
switch key {
case "insecure", "disable_sni", "utls", "ech", "reality":
continue
Expand Down Expand Up @@ -291,6 +291,10 @@ func migrateClients(db *gorm.DB) error {
return db.Save(oldClients).Error
}

func migrateChanges(db *gorm.DB) error {
return db.Migrator().DropColumn(&model.Changes{}, "index")
}

func to1_2(db *gorm.DB) error {
err := moveJsonToDb(db)
if err != nil {
Expand All @@ -304,5 +308,9 @@ func to1_2(db *gorm.DB) error {
if err != nil {
return err
}
return migrateClients(db)
err = migrateClients(db)
if err != nil {
return err
}
return migrateChanges(db)
}
9 changes: 4 additions & 5 deletions backend/database/model/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,8 @@ type Stats struct {
type Changes struct {
Id uint64 `json:"id" gorm:"primaryKey;autoIncrement"`
DateTime int64 `json:"dateTime"`
Actor string `json:"Actor"`
Key string `json:"key" form:"key"`
Action string `json:"action" form:"action"`
Index uint `json:"index" form:"index"`
Obj json.RawMessage `json:"obj" form:"obj"`
Actor string `json:"actor"`
Key string `json:"key"`
Action string `json:"action"`
Obj json.RawMessage `json:"obj"`
}

0 comments on commit 049cfc5

Please sign in to comment.