Files
PilotVault/API Server/pocketbase/pb_migrations/1720300000_add_users_preferences.js
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

33 lines
1.0 KiB
JavaScript

/// <reference path="../pb_data/types.d.ts" />
// Adds a `preferences` JSON field to the `users` auth collection so each user
// can persist their PilotVault settings (theme, appearance, profile, etc.).
//
// Apply by copying this file into your PocketBase deployment's `pb_migrations/`
// directory and restarting PocketBase (migrations run automatically on boot).
// Written for PocketBase v0.22+/v0.23 (JSVM `migrate((app) => …)` API). If your
// PocketBase is older, add the field manually — see pocketbase/README.md.
migrate(
(app) => {
const users = app.findCollectionByNameOrId('users')
users.fields.add(
new Field({
name: 'preferences',
type: 'json',
required: false,
presentable: false,
// ~5 MB — generous headroom (an optional base64 avatar rides along).
maxSize: 5000000,
}),
)
app.save(users)
},
(app) => {
const users = app.findCollectionByNameOrId('users')
users.fields.removeByName('preferences')
app.save(users)
},
)