vereinshaus/pocketbase/pb_migrations/1779215883_updated_users.js
rene 375a3305bb Add PocketBase schema migrations and migration pipeline
- 8 collections: vereine, gruppen, mitglieder, beitraege, einzuege,
  termine, nachrichten, push_subscriptions
- verein_id relation added to users (multi-tenant isolation)
- API rules enforce tenant separation via @request.auth.verein_id
- docker-compose: --migrationsDir=/pb_data/migrations flag + volume mount
- Makefile: migrations sync step added to deploy target
2026-05-19 20:40:47 +02:00

29 lines
710 B
JavaScript

/// <reference path="../pb_data/types.d.ts" />
migrate((app) => {
const collection = app.findCollectionByNameOrId("_pb_users_auth_")
// add field
collection.fields.addAt(10, new Field({
"cascadeDelete": false,
"collectionId": "pbc_3589557411",
"help": "",
"hidden": false,
"id": "relation145676011",
"maxSelect": 1,
"minSelect": 0,
"name": "verein_id",
"presentable": false,
"required": false,
"system": false,
"type": "relation"
}))
return app.save(collection)
}, (app) => {
const collection = app.findCollectionByNameOrId("_pb_users_auth_")
// remove field
collection.fields.removeById("relation145676011")
return app.save(collection)
})