* 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>
61 lines
1.3 KiB
Go
61 lines
1.3 KiB
Go
package migrations
|
|
|
|
import (
|
|
"encoding/json"
|
|
|
|
"github.com/pocketbase/pocketbase/core"
|
|
m "github.com/pocketbase/pocketbase/migrations"
|
|
)
|
|
|
|
func init() {
|
|
m.Register(func(app core.App) error {
|
|
collection, err := app.FindCollectionByNameOrId("goeo2ubp103rzp9")
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
// add field
|
|
if err := collection.Fields.AddMarshaledJSONAt(8, []byte(`{
|
|
"exceptDomains": null,
|
|
"hidden": false,
|
|
"id": "url2434853685",
|
|
"name": "iri",
|
|
"onlyDomains": null,
|
|
"presentable": false,
|
|
"required": false,
|
|
"system": false,
|
|
"type": "url"
|
|
}`)); err != nil {
|
|
return err
|
|
}
|
|
|
|
// update collection data
|
|
if err := json.Unmarshal([]byte(`{
|
|
"indexes": [
|
|
"CREATE UNIQUE INDEX `+"`"+`idx_GgX6MsdCJq`+"`"+` ON `+"`"+`waypoints`+"`"+` (`+"`"+`iri`+"`"+`) WHERE iri IS NOT NULL AND iri != \"\";"
|
|
]
|
|
}`), &collection); err != nil {
|
|
return err
|
|
}
|
|
|
|
return app.Save(collection)
|
|
}, func(app core.App) error {
|
|
collection, err := app.FindCollectionByNameOrId("goeo2ubp103rzp9")
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
// update collection data
|
|
if err := json.Unmarshal([]byte(`{
|
|
"indexes": []
|
|
}`), &collection); err != nil {
|
|
return err
|
|
}
|
|
|
|
// remove field
|
|
collection.Fields.RemoveById("url2434853685")
|
|
|
|
return app.Save(collection)
|
|
})
|
|
}
|