CLI Usage
Complete guide for using MSR Firebase from the command line.
Quick Start
Install and run migrations with a single command:
# Install
npm install @migration-script-runner/firebase
# Run migrations
npx msr-firebase migrate \
--database-url https://your-project.firebaseio.com \
--credentials ./serviceAccountKey.json
CLI Sections
Commands
Firebase-specific commands for managing migrations and database operations.
Configuration
CLI flags and options for configuring MSR Firebase behavior.
Examples
Real-world CLI workflows and usage patterns.
CI/CD Integration
Using MSR Firebase CLI in continuous integration and deployment pipelines.
Common Commands
Run Migrations
# With inline credentials
npx msr-firebase migrate \
--database-url https://your-project.firebaseio.com \
--credentials ./serviceAccountKey.json
# With environment variables
export DATABASE_URL=https://your-project.firebaseio.com
export GOOGLE_APPLICATION_CREDENTIALS=./serviceAccountKey.json
npx msr-firebase migrate
Check Status
# List migrations
npx msr-firebase list
# Show Firebase connection info
npx msr-firebase firebase:info
# Test connection
npx msr-firebase firebase:test-connection
Rollback
# Rollback last migration
npx msr-firebase down <timestamp>
# Example
npx msr-firebase down 202501150001
Inherited Commands
MSR Firebase inherits standard migration commands from MSR Core:
migrate- Run pending migrationslist- List all migrations with statusdown- Rollback migrationsvalidate- Validate migration scriptsbackup- Backup operationslock:status- Check migration lock statuslock:release- Force release migration lock
For detailed documentation of these commands, see MSR Core CLI Documentation.