clean up changes

This commit is contained in:
Alireza Ahmadi
2025-01-19 02:26:48 +01:00
parent 891a61ac16
commit 049cfc5287
2 changed files with 14 additions and 7 deletions
+10 -2
View File
@@ -247,7 +247,7 @@ func migrateTls(db *gorm.DB) error {
if err != nil { if err != nil {
continue continue
} }
for key, _ := range tlsClient { for key := range tlsClient {
switch key { switch key {
case "insecure", "disable_sni", "utls", "ech", "reality": case "insecure", "disable_sni", "utls", "ech", "reality":
continue continue
@@ -291,6 +291,10 @@ func migrateClients(db *gorm.DB) error {
return db.Save(oldClients).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 { func to1_2(db *gorm.DB) error {
err := moveJsonToDb(db) err := moveJsonToDb(db)
if err != nil { if err != nil {
@@ -304,5 +308,9 @@ func to1_2(db *gorm.DB) error {
if err != nil { if err != nil {
return err return err
} }
return migrateClients(db) err = migrateClients(db)
if err != nil {
return err
}
return migrateChanges(db)
} }
+4 -5
View File
@@ -49,9 +49,8 @@ type Stats struct {
type Changes struct { type Changes struct {
Id uint64 `json:"id" gorm:"primaryKey;autoIncrement"` Id uint64 `json:"id" gorm:"primaryKey;autoIncrement"`
DateTime int64 `json:"dateTime"` DateTime int64 `json:"dateTime"`
Actor string `json:"Actor"` Actor string `json:"actor"`
Key string `json:"key" form:"key"` Key string `json:"key"`
Action string `json:"action" form:"action"` Action string `json:"action"`
Index uint `json:"index" form:"index"` Obj json.RawMessage `json:"obj"`
Obj json.RawMessage `json:"obj" form:"obj"`
} }