Your ROOT_URL in app.ini is https://git.cloudchain.link/ but you are visiting https://dash.bss.nz/open-source-mirrors/podgrab/blame/commit/2211a35171ba47bc2c63c855eaf1aa04534f7537/db/migrations.go You should set ROOT_URL correctly, otherwise the web may not work correctly.
podgrab/db/migrations.go

44 lines
824 B

package db
import (
"errors"
"fmt"
"time"
"gorm.io/gorm"
)
type localMigration struct {
Name string
Query string
}
var migrations = []localMigration{
{
Name: "2020_11_03_04_42_SetDefaultDownloadStatus",
Query: "update podcast_items set download_status=2 where download_path!='' and download_status=0",
},
}
func RunMigrations() {
for _, mig := range migrations {
ExecuteAndSaveMigration(mig.Name, mig.Query)
}
}
func ExecuteAndSaveMigration(name string, query string) error {
var migration Migration
result := DB.Where("name=?", name).First(&migration)
if errors.Is(result.Error, gorm.ErrRecordNotFound) {
fmt.Println(query)
result = DB.Debug().Exec(query)
if result.Error == nil {
DB.Save(&Migration{
Date: time.Now(),
Name: name,
})
}
return result.Error
}
return nil
}