Documentation
¶
Overview ¶
Command metapi-migrate is a standalone CLI that transfers all 18 application tables between a SQLite database and a PostgreSQL database (either direction).
The migration logic lives in store.RunMigration so the same code path is callable from the admin migrate handler (queued as a background task). This file is a thin flag-parsing + summary-printing wrapper.
Usage:
metapi-migrate --from sqlite://data/hub.db --to postgres://user:pass@host:5432/db metapi-migrate --from postgres://user:pass@host:5432/db --to sqlite://data/hub.db metapi-migrate --from sqlite://data/hub.db --to postgres://user:pass@host:5432/db --dry-run metapi-migrate --from sqlite://data/hub.db --to postgres://user:pass@host:5432/db --overwrite --progress --verify
The migration matches the TS databaseMigrationService.ts behaviour: - Per-column type coercion with fallback defaults - JSON column serialization (14 columns across 6 tables) - FK-safe DELETE order during overwrite - PostgreSQL sequence synchronization after insert (PG targets only; SQLite AUTOINCREMENT handles itself) - Single-transaction boundary with rollback on error - Settings key filtering (skips db_type, db_url, db_ssl)