Agent skill · software engineering · davila7
PocketBase Migrations
Schema migrations and versioning for PocketBase. Use when creating migrations, managing schema versions, syncing collections between environments, using automigrate, or creating collections programmatically. Covers migrate commands, migration file format, snapshot imports, and the _migrations tracking table.
Why this skill is useful
Adds specific PocketBase migration commands and file formats that the AI wouldn't reliably generate on its own.
What it needs
About 4k tokens when loaded. Last updated 2026-08-06. 30,138 stars on the source repository.
What this skill does
PocketBase Migrations & Schema Versioning Overview PocketBase supports two approaches to schema management: 1. Auto-migrate (default in dev) — Dashboard changes auto-generate migration files in pbmigrations/ 2. Manual migrations — write migration files by hand for full control CLI Commands Auto-migrate Mode Enabled by default. When you change collections in the Dashboard, PocketBase auto-generates migration files in pbmigrations/. Workflow: 1. Develop with auto-migrate ON — use Dashboard to design schema 2. Migration files are auto-generated in pbmigrations/ 3. Commit these files to git 4. Deploy: migrations run automatically on serve start 5. In production: use --automigrate=0 to prevent Dashboard changes from generating new migrations Migration File Format Important: the app inside migrations is a transactional instance. If any error occurs, the entire migration is rolled back. Creating Collections Programmatically Base collection Auth collection View collection Modifying Existing Collections Raw SQL in Migrations Warning: raw SQL bypasses PocketBase's schema cache. Run migrate collections afterward to re-sync if needed. Settings & Superuser in Migrations Initialize app settings Create superuser in migration Snapshot Migrations ./pocketbase migrate collections generates a complete snapshot — useful for: Bootstrapping a new environment Resetting migration history Reviewing full schema in one file The generated file uses app.importCollections(collections) which supports two modes: Default (merge/extend): adds new collections and fields, updates existing ones, doesn't delete anything Delete missing: app.importCollections(collections, true) — deletes collections/fields not in the snapshot migrations Table PocketBase tracks applied migrations in the internal migrations table: id — auto-generated file — migration filename applied — timestamp migrate history-sync marks all existing migration files as applied without running them — useful when importing an existing databa …
How to use it
Reference it in AdaL, Claude Code, Cursor or any coding agent — nothing to install:
@skills davila7/pb-migrations