orma
Version, currently 0.13.028 versions
- 0.13.0latestJun 27, 2026
- 0.12.1not indexedJul 7, 2026
- 0.12.0not indexedJul 7, 2026
- 0.11.0not indexedJul 7, 2026
- 0.10.2not indexedJul 7, 2026
- 0.10.1not indexedJul 7, 2026
- 0.10.0not indexedJul 7, 2026
- 0.9.0not indexedJul 7, 2026
- 0.8.0not indexedJul 7, 2026
- 0.7.1not indexedJul 7, 2026
- 0.7.0not indexedJul 7, 2026
- 0.6.2not indexedJul 7, 2026
- 0.6.1not indexedJul 7, 2026
- 0.6.0not indexedJul 7, 2026
- 0.5.2not indexedJul 7, 2026
- 0.5.1not indexedJul 7, 2026
- 0.5.0not indexedJul 7, 2026
- 0.4.2not indexedJul 7, 2026
- 0.4.1not indexedJul 7, 2026
- 0.4.0not indexedJul 7, 2026
- 0.3.4not indexedJul 7, 2026
- 0.3.3not indexedJul 7, 2026
- 0.3.2not indexedJul 7, 2026
- 0.3.1not indexedJul 7, 2026
- 0.3.0not indexedJul 7, 2026
- 0.2.1not indexedJul 7, 2026
- 0.2.0not indexedJul 7, 2026
- 0.1.0not indexedJul 7, 2026
github.com/sbsoftware/orma
No description declared in shard.yml.
Installation
# Add this to your shard.yml
dependencies:
orma:
github: sbsoftware/orma
version: ~> 0.13.0Then run:
shards installshard.yml
- Crystal
>= 1.11.2- License
- MIT
- Author
- Stefan Bilharz
Dependencies
Runtime Dependencies
- db*github: crystal-lang/crystal-db
- opentelemetry-sdk*github: wyhaines/opentelemetry-sdk.cr
Development Dependencies
- sqlite3*github: crystal-lang/crystal-sqlite3dev
README
Orma
Orma is an ActiveRecord-style persistence layer for Crystal with built-in continuous migration. It aims to keep record definitions, querying, associations, and schema evolution close together so you can move quickly without maintaining a separate migration workflow for every change.
Installation
-
Add the dependency to your
shard.yml:dependencies: orma: github: sbsoftware/orma -
Run
shards install
Usage
require "orma"
# ENV["DATABASE_URL"] must be set
class Post < Orma::Record
column title : String
has_many_of Comment
end
class Comment < Orma::Record
column body : String
belongs_to Post
end
post = Post.create(title: "Hello")
Comment.create(body: "Nice post", post_id: post.id)
comments = Comment.where(post_id: post.id)
comment = comments.first
comment.post.title # => "Hello"
Why Orma
- Define records with columns directly in Crystal
- Query records with a compact, chainable API
- Model relationships with
belongs_toandhas_many - Keep schema changes in sync through continuous migration
- Work against supported database backends without centering the API around one specific adapter
Core Concepts
Records and columns
Define your model as a Crystal class inheriting from Orma::Record. Columns are declared in the class body, and Orma uses those declarations as the source of truth for persistence and schema management.
Query chaining
Records can be queried through a chainable API for filtering, ordering, and limiting result sets, giving you an ActiveRecord-like workflow while staying close to Crystal types.
Associations
Orma supports common record relationships such as belongs_to and has_many, so related records can be modeled directly in your domain classes.
Continuous migration
Continuous migration is an experimental, yet central feature of Orma.
Instead of maintaining a separate migration file for each schema change, Orma can derive and apply structural changes from your record definitions.
Column removal is designed as a staged process. If you want to retire a column, change it from column to deprecated_column. Continuous migration will rename the backing column to _<name>_deprecated while keeping the value readable through the model.
After the deprecated column is no longer needed, remove the deprecated_column declaration from the model. On the next migration run, Orma will delete the matching _<name>_deprecated column. Note that simply removing non-deprecated column definitions will leave them in the database as-is.
This is currently the built-in path for schema evolution and should be treated with appropriate care, especially in production environments.
To enable it, set ENV["ORMA_CONTINUOUS_MIGRATION"]=1. Opting out of it means you'll have to take care of migrations yourself.
Supported Databases
Orma currently supports:
- SQLite3
- PostgreSQL
Development
Run the test suite:
crystal spec
Contributing
- Fork it (https://github.com/sbsoftware/orma/fork)
- Create your feature branch (
git checkout -b my-new-feature) - Commit your changes (
git commit -am 'Add some feature') - Push to the branch (
git push origin my-new-feature) - Create a new Pull Request
Contributors
- Stefan Bilharz - creator and maintainer
Documentation
Built from the current release. The first visit to a release nobody has asked for starts its build.
Links
This release
- Version
0.13.0- Tagged
- Jun 27, 2026
- Commit
6071e983a51d- Crystal
>= 1.11.2- Indexed
- yes
Dependents
Repository
github.com/sbsoftware/orma
Metadata
- Created
- Aug 12, 2026
- Updated
- Aug 18, 2026
- Synced
- Aug 18, 2026
- Versions
- 28