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_650605163")

  // update collection data
  unmarshal({
    "indexes": [
      "CREATE UNIQUE INDEX `idx_N91TFEopK5` ON `menuTiers` (\n  `refId`,\n  `org`\n)"
    ]
  }, collection)

  // add field
  collection.fields.addAt(2, new Field({
    "autogeneratePattern": "",
    "hidden": false,
    "id": "text1861657884",
    "max": 0,
    "min": 0,
    "name": "refId",
    "pattern": "",
    "presentable": false,
    "primaryKey": false,
    "required": false,
    "system": false,
    "type": "text"
  }))

  // add field
  collection.fields.addAt(3, new Field({
    "cascadeDelete": false,
    "collectionId": "pbc_2873630990",
    "hidden": false,
    "id": "relation1914026624",
    "maxSelect": 1,
    "minSelect": 0,
    "name": "org",
    "presentable": false,
    "required": false,
    "system": false,
    "type": "relation"
  }))

  // add field
  collection.fields.addAt(4, new Field({
    "cascadeDelete": false,
    "collectionId": "pbc_3981801833",
    "hidden": false,
    "id": "relation3662021671",
    "maxSelect": 1,
    "minSelect": 0,
    "name": "offers",
    "presentable": false,
    "required": false,
    "system": false,
    "type": "relation"
  }))

  // add field
  collection.fields.addAt(5, new Field({
    "cascadeDelete": false,
    "collectionId": "pbc_3707864393",
    "hidden": false,
    "id": "relation373767074",
    "maxSelect": 1,
    "minSelect": 0,
    "name": "tiers",
    "presentable": false,
    "required": false,
    "system": false,
    "type": "relation"
  }))

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

  // update collection data
  unmarshal({
    "indexes": []
  }, collection)

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

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

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

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

  return app.save(collection)
})