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
This commit is contained in:
parent
94ca36f470
commit
375a3305bb
11 changed files with 931 additions and 2 deletions
29
pocketbase/pb_migrations/1779215883_updated_users.js
Normal file
29
pocketbase/pb_migrations/1779215883_updated_users.js
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
/// <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)
|
||||
})
|
||||
Loading…
Add table
Add a link
Reference in a new issue