← All docs

TypeORM

TypeScript / JavaScript

TypeORM generates migration files with up/down methods. Use query logging to extract SQL.

Auto-Detection

MigrationPilot auto-detects TypeORM via ormconfig or typeorm in package.json.

Migration Path

Default migration file pattern:

src/migrations/**/*.sql

Setup

# Generate a migration
npx typeorm migration:generate -n AddUsers

# TypeORM generates TypeScript files, not raw SQL.
# For best results, use typeorm migration:run --dry-run to preview SQL,
# then analyze the output:
npx typeorm migration:run --dry-run 2>&1 | npx migrationpilot analyze --stdin

GitHub Action

Add to your CI workflow:

- name: Check TypeORM migrations
  run: npx typeorm migration:run --dry-run 2>&1 | npx migrationpilot analyze --stdin --fail-on critical

Configuration

Add a config file to set the default migration path:

# .migrationpilotrc.yml
migrationPath: "src/migrations/**/*.sql"
failOn: critical