Command Line Interface (CLI)
The Hysteria ORM CLI provides a set of commands to manage your database and schema, automate migrations, and run SQL directly from the command line.
If working with typescript (dev environment), you must install typescript
and bundle-require
as dev dependencies in your project.
Accessing the CLI
The CLI is available as a package in your project. You can access it using the npx
command:
npx hysteria <command>
yarn hysteria <command>
# For CommonJS projects (deprecated)
npx hysteria-cjs <command>
Available Commands
- Migrations: Create, run, rollback, and refresh migrations.
- Run SQL: Execute raw SQL queries or files against your database.
- Refresh: Drop all tables or rollback all migrations, then re-run all migrations.
- Create Migration: Generate migration files with templates.
See the sidebar for detailed documentation on each command.
Datasource-first workflow
CLI commands accept a --datasource
(-d
) option pointing to a file that exports a default sql
instance. This keeps configuration in one place and avoids repeating connection flags.
Next: Migrations