Files
dashboard-icons/web/backend/pb_migrations/1759313082_updated_users.js

35 lines
839 B
JavaScript
Raw Normal View History

/// <reference path="../pb_data/types.d.ts" />
migrate((app) => {
const collection = app.findCollectionByNameOrId("_pb_users_auth_")
// update collection data
unmarshal({
"updateRule": "id = @request.auth.id && (@request.body.admin = null || @request.body.admin = admin)"
}, collection)
// add field
collection.fields.addAt(8, new Field({
"hidden": false,
"id": "bool2282622326",
"name": "admin",
"presentable": true,
"required": false,
"system": false,
"type": "bool"
}))
return app.save(collection)
}, (app) => {
const collection = app.findCollectionByNameOrId("_pb_users_auth_")
// update collection data
unmarshal({
"updateRule": "id = @request.auth.id"
}, collection)
// remove field
collection.fields.removeById("bool2282622326")
return app.save(collection)
})