Skip to main content

CLI Overview

The Ormed CLI manages migrations, seeds, and schema tooling.

Before you start: You completed Installation; You understand your runtime connection setup (Configuration).

Running the CLI

Use this if you have ormed_cli in your dev_dependencies. This ensures version parity with your project.

dart run ormed_cli:ormed --help
dart run ormed_cli:ormed init
dart run ormed_cli:ormed migrate
warning

Adding ormed_cli to your project will pull in all database drivers (SQLite, MySQL, Postgres) as transitive dependencies.

Use dart run for team consistency. Use global install for convenience on personal environments.

Config discovery

If present, the CLI finds the nearest ormed.yaml by walking up from the current directory.

If missing, CLI commands fall back to convention defaults:

  • driver: sqlite
  • database: database/<package>.sqlite
  • migrations registry: lib/src/database/migrations.dart
  • seed registry: lib/src/database/seeders.dart

The seed registry path is convention-only unless you scaffold it (ormed init --with-seeders / ormed init --only=seeders) or create your first seeder (ormed make:seeder).

Override the config path explicitly:

dart run ormed_cli:ormed migrate --config path/to/ormed.yaml

Targeting connections

If your ormed.yaml contains multiple connections, target one with:

dart run ormed_cli:ormed migrate --connection analytics
dart run ormed_cli:ormed seed --connection analytics

Production guard

Commands that mutate schema/data prompt for confirmation when the process environment indicates production (ORM_ENV, DART_ENV, FLUTTER_ENV, or ENV equals production).

Use --force (when supported) to skip the prompt.

Quick Verification

dart run ormed_cli:ormed --help
dart run ormed_cli:ormed migrate --pretend

If you use ormed.yaml, also test explicit targeting:

dart run ormed_cli:ormed migrate --config ormed.yaml --connection default --pretend

Read This Next