pocketbase-migrations

Solid

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.

API & Backend 27,984 stars 2901 forks Updated today MIT

Install

View on GitHub

Quality Score: 93/100

Stars 20%
100
Recency 20%
100
Frontmatter 20%
70
Documentation 15%
100
Issue Health 10%
50
License 10%
100
Description 5%
100

Skill Content

# 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 `pb_migrations/` 2. **Manual migrations** — write migration files by hand for full control ## CLI Commands ```bash # Create a new empty migration file ./pocketbase migrate create "add_posts_collection" # Creates: pb_migrations/1234567890_add_posts_collection.js # Apply all pending migrations ./pocketbase migrate up # Revert the last applied migration ./pocketbase migrate down # Generate a full snapshot of all current collections ./pocketbase migrate collections # Creates a migration file that recreates all collections from scratch # Sync migration history with actual DB state (mark all as applied) ./pocketbase migrate history-sync ``` ## Auto-migrate Mode Enabled by default. When you change collections in the Dashboard, PocketBase auto-generates migration files in `pb_migrations/`. ```bash # Start with auto-migrate (default) ./pocketbase serve # Disable auto-migrate (production) ./pocketbase serve --automigrate=0 ``` **Workflow**: 1. Develop with auto-migrate ON — use Dashboard to design schema 2. Migration files are auto-generated in `pb_migrations/` 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 ``...

Details

Author
davila7
Repository
davila7/claude-code-templates
Created
11 months ago
Last Updated
today
Language
Python
License
MIT

Integrates with

Similar Skills

Semantically similar based on skill content — not just same category