Files
tajniak81andClaude Opus 4.8 afc6952eda Initial commit: PilotVault multi-service project
Add API Server (Go/PocketBase), Web App (Go BFF + Vue), Fly App
(Flutter/DJI MSDK), Adobe Plugin, and Docker/Docker AIO deployment
configs. Design assets and build artifacts are gitignored.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-13 11:43:33 +02:00

39 lines
1.4 KiB
JavaScript

/// <reference path="../pb_data/types.d.ts" />
// Adds a `pluginSettings` JSON field to both the `users` auth collection and the
// `organizations` collection. It backs the per-user / per-organization layers of
// the OpenSky plugin's cascading settings (API Server → Org Admin → User):
// { "opensky": { "config": { clientId, clientSecret, plan, bbox }, "enabled": bool } }
// The `enabled` flag is only meaningful on `users` (enablement is strictly per-user).
//
// Apply by copying this file into your PocketBase deployment's `pb_migrations/`
// directory and restarting PocketBase (migrations run automatically on boot).
// Idempotent: skips a collection whose field is already present. Written for
// PocketBase v0.22+/v0.23 (JSVM `migrate((app) => …)` API).
migrate(
(app) => {
for (const name of ['users', 'organizations']) {
const col = app.findCollectionByNameOrId(name)
if (col.fields.getByName('pluginSettings')) continue
col.fields.add(
new Field({
name: 'pluginSettings',
type: 'json',
required: false,
presentable: false,
maxSize: 100000, // small JSON blob of plugin config
}),
)
app.save(col)
}
},
(app) => {
for (const name of ['users', 'organizations']) {
const col = app.findCollectionByNameOrId(name)
col.fields.removeByName('pluginSettings')
app.save(col)
}
},
)