pb-migrations
Skill by davila7
Explains how to manage PocketBase schema migrations and versioning. It covers migrate commands, migration file format, auto-migrate, and creating collections in code. Useful for developers syncing schema between environments.
Install pb-migrations
Built from the published package, never by AI.
git clone --depth 1 https://github.com/davila7/claude-code-templates /tmp/claude-code-templates && mkdir -p ~/.claude/skills && cp -r /tmp/claude-code-templates/cli-tool/components/skills/pocketbase/pb-migrations ~/.claude/skills/pb-migrationsRun in your terminal. Claude Code loads skills from ~/.claude/skills automatically.
git clone --depth 1 https://github.com/davila7/claude-code-templates /tmp/claude-code-templates && mkdir -p ~/.gemini/antigravity-cli/skills && cp -r /tmp/claude-code-templates/cli-tool/components/skills/pocketbase/pb-migrations ~/.gemini/antigravity-cli/skills/pb-migrationsAntigravity CLI loads skills from ~/.gemini/antigravity-cli/skills, or .agents/skills for one project.
Skills can run scripts on your machine. Some need an API key: check the README.
About
pb-migrations is an agent skill for managing schema migrations and versioning in PocketBase. It covers the migrate commands (create, up, down, collections, and history-sync), the migration file format, and creating base, auth, and view collections in code. It also explains snapshot imports and the _migrations tracking table.
Auto-migrate is on by default in development, where Dashboard changes generate files in pb_migrations/. The source recommends running production with --automigrate=0 and applying migrations on serve start. The skill is aimed at developers building on PocketBase who want versioned, reversible schema changes across environments.
Written from the project's SKILL.md and checked against it.
What it can do
- Migrate commandsCreate, apply, revert, snapshot, and sync migration history with the pocketbase migrate commands.
- Migration file formatWrite up and down functions in JavaScript migration files under pb_migrations/.
- Programmatic collectionsCreate base, auth, and view collections in code with fields, rules, and indexes.
- Modifying collectionsAdd or remove fields, update API rules, and add indexes on existing collections.
- Raw SQL migrationsRun SQL statements inside migrations with a matching down step.
- Settings and superuser setupInitialize app settings and create a superuser from environment variables in a migration.
- Snapshot importsGenerate a full collection snapshot and import it with merge or delete-missing modes.
- Auto-migrateGenerate migration files from Dashboard changes during development.
What you need
- PocketBase binary, run as ./pocketbase
- PB_ADMIN_EMAIL and PB_ADMIN_PASSWORD environment variables for the superuser migration
- SMTP_USER and SMTP_PASS environment variables for the SMTP settings example
Try asking
- Write a PocketBase migration that adds a posts collection with a title and author relation.
- Explain how to use auto-migrate in development and disable it in production.
- Generate a snapshot migration of my current PocketBase collections.
Good to know
- Raw SQL bypasses PocketBase's schema cache, so run migrate collections afterward if needed.
- An empty listRule or viewRule means public access.
- Delete-missing import mode removes collections and fields that are not in the snapshot.
- Applied migrations should not be edited. Create a new migration to fix issues.
Security check
ANo download-and-run commands, hidden instructions or signs of sending keys out were found.
Checked automatically: cli-tool/components/skills/pocketbase/pb-migrations/SKILL.md. This looks for known risky patterns and is not a full audit. How grades work
Inside the skill
-
SKILL.md9 KB
Alternatives to pb-migrations
All alternatives →Creates, configures and manages datasets on the Hugging Face Hub, including SQL-based querying and transformation. Built for people who edit dataset content and metadata directly, alongside the HF MCP server.
Diagnoses and repairs gbrain's Postgres access when a command or MCP result shows a GBRAIN_DB_ACCESS marker, or when the operator reports the brain database is down. It runs the hardcoded gbrain db-repair ladder and verifies the result with a re-probe.
Manages clusters, instances, and backups for AlloyDB for PostgreSQL. Built for creating, configuring, and administering AlloyDB databases, not general PostgreSQL or Cloud SQL instances.
Writes, reviews and migrates Supabase logs queries against the ClickHouse logs table served by the logs.all.otel endpoint. Built for developers who write Logs Explorer SQL or convert older BigQuery logs queries.
Diagnoses and fixes slow Paperclip PostgreSQL queries using Cloud and Neon evidence, local benchmarks, regression tests, and a pull request with passing checks. Built for engineers working on Paperclip.
Guides AI assistants through Prisma 8 projects built on @prisma/orm-postgres, @prisma/orm-sqlite, or @prisma/orm-mongo. It covers data contracts, migrations, typed queries and runtime setup for developers on Prisma 8.
Compare with hugging-face-datasets, db-repair or alloydb-basics
pb-migrations: common questions
How do I stop Dashboard changes from creating migrations in production?
Start the server with --automigrate=0. The source says this prevents Dashboard changes from generating new migrations in production.
What happens if a PocketBase migration fails?
The app inside migrations is transactional. If any error occurs, the entire migration is rolled back.
How do I mark existing migration files as applied for an imported database?
Run migrate history-sync. It marks all existing migration files as applied without running them.
How do I install pb-migrations?
Run the command above to copy the skill into ~/.claude/skills/. Claude Code picks it up automatically.
Is pb-migrations free?
The code is published under the MIT licence. The service it connects to may have its own pricing.
Is pb-migrations safe to use?
It scores 91 of 100. Grades: maintenance A, licence A, quality A. Security check: grade A, no risky patterns found in the files checked. Review the code before you install. How grades work.
What are alternatives to pb-migrations?
Similar skills: hugging-face-datasets, db-repair, alloydb-basics, clickhouse-logs-queries.
