Migrations ​
AYB supports migration from 6 source platforms and ongoing SQL migration workflows after import.
Firebase migration support remains historical in-tree and retired from roadmap scope. No new Firebase live-validation or expansion work is scheduled.
Migrate in one command (ayb start --from) ​
For the fastest path, start AYB and migrate in one step:
# PocketBase (path detection)
ayb start --from ./pb_data
# Supabase (postgres URL detection)
ayb start --from postgres://postgres:[email protected]:5432/postgres
# Firebase auth export (json detection)
ayb start --from ./auth-export.jsonayb start --from auto-detects only:
- PocketBase path (
pb_data) - Supabase Postgres URL
- Firebase
.jsonauth export
Appwrite, Directus, and Nhost require explicit ayb migrate <source> commands.
For first-time setup context, see Getting Started.
Shared migration flow ​
All source migrations follow the same pattern:
- Pre-flight analysis (
Analyze) to count tables/users/policies/files. - Confirmation prompt (skip with
-y/--yes). - Transactional database migration execution.
- Post-commit storage copy when the source includes files.
- Validation summary comparing expected vs migrated totals.
Shared flags (all source migrations) ​
| Flag | Description |
|---|---|
--dry-run | Analyze and preview without applying changes |
--verbose | Emit detailed migration progress |
--yes, -y | Skip confirmation prompt |
--json | Machine-readable stats output |
PocketBase ​
ayb migrate pocketbase --source ./pb_data --database-url "$DATABASE_URL"What is migrated:
- Collections -> PostgreSQL tables
- Collection fields -> columns
- API rules -> RLS policies
- Auth users ->
_ayb_users - Records -> table data
- Files -> AYB storage (optional)
Source-specific flags:
--source(required)--database-url(required for standaloneayb migrate pocketbase; managed Postgres is used automatically withayb start --from)--skip-files--force
Supabase ​
ayb migrate supabase \
--source-url postgres://postgres:[email protected]:5432/postgres \
--database-url "$DATABASE_URL"What is migrated:
- Public schema tables + data
auth.users->_ayb_usersauth.identities->_ayb_oauth_accounts- RLS policy rewrite from
auth.uid()style to AYB session vars - Storage exports -> AYB storage layout
Source-specific flags:
--source-url(required)--database-url(required)--force--skip-data--skip-oauth--skip-rls--skip-storage--include-anonymous--storage-export--storage-path
RLS behavior details: see Security.
Firebase ​
ayb migrate firebase \
--auth-export ./auth-export.json \
--firestore-export ./firestore-export \
--rtdb-export ./rtdb-export.json \
--storage-export ./storage-export \
--database-url "$DATABASE_URL"What is migrated:
- Auth users with Firebase scrypt hash preservation
- OAuth links ->
_ayb_oauth_accounts - Firestore exports -> JSONB tables + GIN indexes
- RTDB exports -> JSONB tables + GIN indexes
- Cloud Storage files -> AYB storage
Source-specific flags:
--auth-export--firestore-export--rtdb-export--storage-export--storage-path--database-url(required)
At least one export source flag must be provided.
Appwrite ​
ayb migrate appwrite --export ./appwrite-export.json --database-url "$DATABASE_URL"What is migrated:
- Appwrite export schema -> tables
- Appwrite records -> table data (unless skipped)
- Generated RLS policies (unless skipped)
Source-specific flags:
--export(required)--database-url(required)--skip-rls--skip-data
Directus ​
ayb migrate directus --snapshot ./directus-snapshot.json --database-url "$DATABASE_URL"What is migrated:
- Directus schema snapshot -> tables/columns
- Generated RLS policies (unless skipped)
Source-specific flags:
--snapshot(required)--database-url(required)--skip-rls
Nhost ​
ayb migrate nhost \
--hasura-metadata ./metadata \
--pg-dump ./dump.sql \
--database-url "$DATABASE_URL"What is migrated:
- Hasura metadata + pg_dump -> AYB schema/data
- Generated RLS policies (unless skipped)
Source-specific flags:
--hasura-metadata(required)--pg-dump(required)--database-url(required)--skip-rls
SQL migration workflow after import ​
After initial platform migration, use standard SQL migrations for ongoing changes:
ayb migrate create add_orders_table
ayb migrate up --database-url "$DATABASE_URL"
ayb migrate status --database-url "$DATABASE_URL"
ayb migrate diff --database-url "$DATABASE_URL"
ayb migrate generate add_indexes --database-url "$DATABASE_URL"Management commands:
migrate create <name>migrate upmigrate statusmigrate diffmigrate generate <name>
Full command tree reference: CLI Reference.
Operational recommendations ​
- Take a backup before large migrations. See Backups.
- Start with
--dry-runto validate source shape and row counts. - Use
--jsonin CI or scripted migration jobs. - Review validation summaries and resolve mismatches before cutover.