fixes trail sorting && secure cookie
This commit is contained in:
38
db/migrations/1718486749_update_sortable_attributes.go
Normal file
38
db/migrations/1718486749_update_sortable_attributes.go
Normal file
@@ -0,0 +1,38 @@
|
||||
package migrations
|
||||
|
||||
import (
|
||||
"os"
|
||||
|
||||
"github.com/meilisearch/meilisearch-go"
|
||||
"github.com/pocketbase/dbx"
|
||||
|
||||
m "github.com/pocketbase/pocketbase/migrations"
|
||||
)
|
||||
|
||||
func init() {
|
||||
client := meilisearch.NewClient(meilisearch.ClientConfig{
|
||||
Host: os.Getenv("MEILI_URL"),
|
||||
APIKey: os.Getenv("MEILI_MASTER_KEY"),
|
||||
})
|
||||
m.Register(func(db dbx.Builder) error {
|
||||
_, err := client.Index("trails").UpdateSortableAttributes(&[]string{
|
||||
"created", "date", "difficulty", "distance", "elevation_gain", "name",
|
||||
})
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}, func(db dbx.Builder) error {
|
||||
_, err := client.Index("trails").UpdateSortableAttributes(&[]string{
|
||||
"created", "difficulty", "distance", "elevation_gain", "name",
|
||||
})
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user