* optimize db view queries * add more indices * appease gofmt --------- Co-authored-by: Flomp <Flomp@users.noreply.github.com> Co-authored-by: Christian Beutel <>
44 lines
972 B
Go
44 lines
972 B
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("1kot7t9na3hi0gl")
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
// update collection data
|
|
if err := json.Unmarshal([]byte(`{
|
|
"indexes": [
|
|
"CREATE INDEX `+"`"+`idx_rfc8s4r53e`+"`"+` ON `+"`"+`list_share`+"`"+` (`+"`"+`actor`+"`"+`)",
|
|
"CREATE INDEX `+"`"+`idx_t2ggivugt5`+"`"+` ON `+"`"+`list_share`+"`"+` (`+"`"+`list`+"`"+`)"
|
|
]
|
|
}`), &collection); err != nil {
|
|
return err
|
|
}
|
|
|
|
return app.Save(collection)
|
|
}, func(app core.App) error {
|
|
collection, err := app.FindCollectionByNameOrId("1kot7t9na3hi0gl")
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
// update collection data
|
|
if err := json.Unmarshal([]byte(`{
|
|
"indexes": []
|
|
}`), &collection); err != nil {
|
|
return err
|
|
}
|
|
|
|
return app.Save(collection)
|
|
})
|
|
}
|