| Crates.io | premix-cli |
| lib.rs | premix-cli |
| version | 1.0.6-alpha |
| created_at | 2026-01-17 18:01:11.110256+00 |
| updated_at | 2026-01-20 20:33:51.28928+00 |
| description | Command-line tool for Premix ORM (Migration management and more). |
| homepage | |
| repository | https://github.com/premix-labs/premix-orm |
| max_upload_size | |
| id | 2050871 |
| size | 96,382 |
The official command-line tool for Premix ORM.
premix-cli provides utilities for managing migrations and basic project setup.
This crate is part of a research prototype. APIs may change and production use is not recommended yet.
cargo install premix-cli
premix schema (requires premix-schema bin)Currently a placeholder for future scaffolding.
premix init
Premix ORM supports SQL-based migrations. You can create, run, and revert them using the CLI.
Creates a new .sql file in the migrations/ directory with up and down steps.
premix migrate create create_users
# Output: Created migration: migrations/20240101123456_create_users.sql
Applies all pending migrations to the database.
# Uses DATABASE_URL env var by default, or defaults to sqlite:premix.db
premix migrate up
# Or specify database URL locally
premix migrate up --database sqlite:my_app.db
Reverts the last applied migration.
premix migrate down
Synchronize your Rust #[derive(Model)] structs with the database schema implicitly.
premix sync
The CLI looks for src/bin/premix-sync.rs and runs it. Use that binary to
call Premix::sync for the models you want to create.
Note: For robustness, we still recommend calling Premix::sync(&pool) in your
application code on startup.
Diff or generate migrations from local models (SQLite v1).
premix schema diff --database sqlite:my_app.db
premix schema migrate --database sqlite:my_app.db --out migrations/20260101000000_schema.sql
The CLI looks for src/bin/premix-schema.rs and runs it. That binary should
use premix_core::schema to compare models to the live database and print SQL
when running migrate.
Recommended output includes a summary using
premix_core::schema::format_schema_diff_summary.
--features postgres when building.The CLI primarily relies on the DATABASE_URL environment variable.
# Example .env or shell export
export DATABASE_URL="sqlite:premix.db?mode=rwc"
This project is licensed under the MIT license.