Hello from MCP server

List Files | Just Commands | Repo | Logs

← back |
/// <reference path="../pb_data/types.d.ts" />
migrate((app) => {
  const collection = app.findCollectionByNameOrId("pbc_4141165654")

  // update collection data
  unmarshal({
    "listRule": "@request.auth.activeOrg = org",
    "viewRule": "@request.auth.activeOrg = org"
  }, collection)

  // remove field
  collection.fields.removeById("relation801969836")

  return app.save(collection)
}, (app) => {
  const collection = app.findCollectionByNameOrId("pbc_4141165654")

  // update collection data
  unmarshal({
    "listRule": "@request.auth.activeOrg = org || @request.auth.activeOrg ?= subscribers",
    "viewRule": "@request.auth.activeOrg = org || @request.auth.activeOrg ?= subscribers"
  }, collection)

  // add field
  collection.fields.addAt(4, new Field({
    "cascadeDelete": false,
    "collectionId": "pbc_2873630990",
    "hidden": false,
    "id": "relation801969836",
    "maxSelect": 999,
    "minSelect": 0,
    "name": "subscribers",
    "presentable": false,
    "required": false,
    "system": false,
    "type": "relation"
  }))

  return app.save(collection)
})