Firebase-Specific Commands

Commands unique to MSR Firebase for database inspection and management.

Table of contents

  1. firebase:info
  2. firebase:test-connection
  3. firebase:nodes
  4. firebase:backup-nodes
    1. Backup Single Node
    2. Backup Multiple Nodes
    3. Backup Non-Existent Node
  5. Standard Migration Commands
    1. migrate
    2. down / rollback
    3. list
    4. validate
    5. backup
    6. lock:status
    7. lock:release

firebase:info

Show Firebase connection information.

npx msr-firebase firebase:info

Output:

๐Ÿ“Š Firebase Connection Information:

  Database URL: https://DATABASE-NAME.REGION.firebasedatabase.app
  Shift Path:   /production
  Table Name:   schema_version

Use Cases:

  • Verify connection settings
  • Check which environment youโ€™re connected to
  • Debug configuration issues

firebase:test-connection

Test Firebase database connection.

npx msr-firebase firebase:test-connection \
  --database-url https://DATABASE-NAME.REGION.firebasedatabase.app \
  --credentials ./serviceAccountKey.json

Output:

โœ… Firebase connection successful!
   Connected to: https://DATABASE-NAME.REGION.firebasedatabase.app

Use Cases:

  • Validate credentials before running migrations
  • Test connectivity in CI/CD pipelines
  • Verify firewall/network access

firebase:nodes

List all root nodes in Firebase database.

npx msr-firebase firebase:nodes

Output:

๐Ÿ“‚ Root Nodes:

  1. users
  2. posts
  3. schema_version
  4. settings

  Total: 4 nodes

Use Cases:

  • Inspect database structure
  • Verify migrations created expected nodes
  • Database exploration and debugging

With Shift Path:

# Lists nodes under /production/*
npx msr-firebase firebase:nodes --database-url https://... --shift production

firebase:backup-nodes

Backup specific Firebase nodes to JSON.

npx msr-firebase firebase:backup-nodes <nodes...> [options]

Arguments:

  • <nodes...> - Node paths to backup (space-separated)

Examples:

Backup Single Node

npx msr-firebase firebase:backup-nodes users

Output:

๐Ÿ’พ Node Backup:

  โœ… users: 15234 bytes

๐Ÿ“„ Backup Data:

{
  "users": {
    "user1": { "name": "Alice", "email": "alice@example.com" },
    "user2": { "name": "Bob", "email": "bob@example.com" }
  }
}

Backup Multiple Nodes

npx msr-firebase firebase:backup-nodes users posts settings

Backup Non-Existent Node

npx msr-firebase firebase:backup-nodes missing_node

Output:

๐Ÿ’พ Node Backup:

  โš ๏ธ  missing_node: (not found)

๐Ÿ“„ Backup Data:

{
  "missing_node": null
}

Use Cases:

  • Backup specific data before risky operations
  • Export data for analysis or migration
  • Create selective backups for testing

Standard Migration Commands

MSR Firebase inherits standard migration commands from MSR Core:

migrate

Run pending migrations.

npx msr-firebase migrate [targetVersion] [options]

down / rollback

Roll back migrations.

npx msr-firebase down "<targetVersion>"

targetVersion is a numeric migration version. Migrations newer than that target are rolled back.

list

List all migrations with status.

npx msr-firebase list [options]

validate

Validate migration scripts.

npx msr-firebase validate

backup

Create, restore, or delete a backup using the Core CLI subcommands.

npx msr-firebase backup create
npx msr-firebase backup restore "<backupPath>"

Use the file path printed by backup create with backup restore. The CLI starts a new runner process for each command, so it cannot infer the previous commandโ€™s in-memory backup path when the argument is omitted. The Core CLI also exposes backup delete, but that command has no path argument and a fresh runner has no current backup file; manage retained files through your own storage and retention process instead. Review Backup & Restore before restoring production data.

lock:status

Check migration lock status.

npx msr-firebase lock:status

lock:release

Force release migration lock.

npx msr-firebase lock:release [options]

Full Documentation: For detailed documentation of standard migration commands, see the MSR Core CLI Reference.