Adds collections and types

This commit is contained in:
2025-05-27 18:07:26 -07:00
parent b96fe1371e
commit f61ebef59a
5 changed files with 260 additions and 0 deletions

View File

@@ -0,0 +1,58 @@
/// <reference path="../pb_data/types.d.ts" />
migrate((app) => {
const collection = app.findCollectionByNameOrId("pbc_3332084752")
// update collection data
unmarshal({
"createRule": "",
"deleteRule": "@request.auth.id = campaign.owner.id",
"listRule": "@request.auth.id = campaign.owner.id",
"updateRule": "@request.auth.id = campaign.owner.id",
"viewRule": "@request.auth.id = campaign.owner.id"
}, collection)
// update field
collection.fields.addAt(1, new Field({
"cascadeDelete": true,
"collectionId": "pbc_2270728936",
"hidden": false,
"id": "relation1542800728",
"maxSelect": 1,
"minSelect": 0,
"name": "campaign",
"presentable": false,
"required": true,
"system": false,
"type": "relation"
}))
return app.save(collection)
}, (app) => {
const collection = app.findCollectionByNameOrId("pbc_3332084752")
// update collection data
unmarshal({
"createRule": null,
"deleteRule": null,
"listRule": null,
"updateRule": null,
"viewRule": null
}, collection)
// update field
collection.fields.addAt(1, new Field({
"cascadeDelete": true,
"collectionId": "pbc_2270728936",
"hidden": false,
"id": "relation1542800728",
"maxSelect": 1,
"minSelect": 0,
"name": "field",
"presentable": false,
"required": true,
"system": false,
"type": "relation"
}))
return app.save(collection)
})