mirror of
https://github.com/muety/wakapi.git
synced 2025-12-05 22:20:24 -08:00
31 lines
545 B
Go
31 lines
545 B
Go
package migrations
|
|
|
|
import (
|
|
"github.com/muety/wakapi/config"
|
|
"github.com/muety/wakapi/models"
|
|
"gorm.io/gorm"
|
|
)
|
|
|
|
func init() {
|
|
const name = "20241220-share_activity_chart_flag"
|
|
f := migrationFunc{
|
|
name: name,
|
|
f: func(db *gorm.DB, cfg *config.Config) error {
|
|
if hasRun(name, db) {
|
|
return nil
|
|
}
|
|
|
|
db.
|
|
Model(&models.User{}).
|
|
Where("share_data_max_days < ?", 0).
|
|
Or("share_data_max_days >= ?", 365).
|
|
Update("share_activity_chart", true)
|
|
|
|
setHasRun(name, db)
|
|
return nil
|
|
},
|
|
}
|
|
|
|
registerPostMigration(f)
|
|
}
|