Guides

Comprehensive guides and practical examples for using Migration Script Runner effectively.

Core Usage

Writing Migrations

Best practices for creating migration scripts:

  • Migration file structure
  • up() and down() methods
  • Database operations
  • Error handling

SQL Migrations

Complete guide to SQL migration files (v0.4.0+):

  • Using .up.sql and .down.sql files
  • ISqlDB interface implementation
  • Mixing TypeScript and SQL migrations
  • Database-specific SQL features

Version Control

Controlled migrations and rollbacks:

  • up() for specific versions
  • down() for rollbacks
  • Version targeting strategies
  • Migration workflows

Backup & Restore Workflows

Database backup and restore operations:

  • Environment synchronization
  • Disaster recovery
  • Database cloning
  • Production to staging workflows

Practical Examples

Recipes

Complete, copy-paste-ready implementations for common scenarios:

  • PostgreSQL with backup/restore
  • MongoDB migrations
  • Testing patterns
  • Multi-database coordination
  • Custom validation


Table of contents