Skip to content

Commit

Permalink
feat: ✨ add migration to make create keys admin only
Browse files Browse the repository at this point in the history
  • Loading branch information
Dan6erbond committed May 19, 2023
1 parent 42b717f commit bfeb6ae
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions server/migrations/1684489645_updated_tokens.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package migrations

import (
"github.com/pocketbase/dbx"
"github.com/pocketbase/pocketbase/daos"
m "github.com/pocketbase/pocketbase/migrations"
"github.com/pocketbase/pocketbase/tools/types"
)

func init() {
m.Register(func(db dbx.Builder) error {
dao := daos.New(db);

collection, err := dao.FindCollectionByNameOrId("zjulwnkxemfb9i2")
if err != nil {
return err
}

collection.CreateRule = nil

return dao.SaveCollection(collection)
}, func(db dbx.Builder) error {
dao := daos.New(db);

collection, err := dao.FindCollectionByNameOrId("zjulwnkxemfb9i2")
if err != nil {
return err
}

collection.CreateRule = types.Pointer("owner.id = @request.auth.id")

return dao.SaveCollection(collection)
})
}

0 comments on commit bfeb6ae

Please sign in to comment.