* initial commit * add lists * update permissions * fix waypoint create * needs_full_sync for activitypub trails * fixes build issues * fix list get * further CSRF protection * update API docs * adds rate limiter * fix tiptap mentions * a bit more cleanup of main.go * Fix migration order * fixes reviewed notes * require context for activitpub server calls * improve hashing for identifier * fix copy paste error * fix sync trail/list issues * fix summit log/comment duplicates * adaptions after trail merge * fix dockerignore --------- Co-authored-by: Christian Beutel <> Co-authored-by: slothful-vassal <89943360+slothful-vassal@users.noreply.github.com>
34 lines
625 B
Go
34 lines
625 B
Go
package migrations
|
|
|
|
import (
|
|
"github.com/pocketbase/pocketbase/core"
|
|
m "github.com/pocketbase/pocketbase/migrations"
|
|
)
|
|
|
|
func init() {
|
|
m.Register(func(app core.App) error {
|
|
wps, err := app.FindAllRecords("waypoints")
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
for _, wp := range wps {
|
|
actor, err := app.FindFirstRecordByData("activitypub_actors", "user", wp.GetString("user"))
|
|
if err != nil {
|
|
return err
|
|
}
|
|
wp.Set("author", actor.Id)
|
|
err = app.UnsafeWithoutHooks().Save(wp)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
}
|
|
|
|
return nil
|
|
}, func(app core.App) error {
|
|
// add down queries...
|
|
|
|
return nil
|
|
})
|
|
}
|