{"id":17679922,"url":"https://github.com/sbsoftware/orma","last_synced_at":"2026-05-16T00:20:40.329Z","repository":{"id":227830413,"uuid":"772129765","full_name":"sbsoftware/orma","owner":"sbsoftware","description":null,"archived":false,"fork":false,"pushed_at":"2025-05-12T19:57:11.000Z","size":86,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-05-12T22:55:00.826Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Crystal","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sbsoftware.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-03-14T15:36:24.000Z","updated_at":"2025-05-12T19:57:14.000Z","dependencies_parsed_at":"2024-03-16T11:26:13.264Z","dependency_job_id":"3d875cb6-c1d9-4afc-bbc3-6a1a7d1c53bf","html_url":"https://github.com/sbsoftware/orma","commit_stats":null,"previous_names":["sbsoftware/orma"],"tags_count":20,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sbsoftware%2Forma","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sbsoftware%2Forma/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sbsoftware%2Forma/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sbsoftware%2Forma/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sbsoftware","download_url":"https://codeload.github.com/sbsoftware/orma/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253837400,"owners_count":21971982,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-24T09:04:43.074Z","updated_at":"2026-05-16T00:20:40.309Z","avatar_url":"https://github.com/sbsoftware.png","language":"Crystal","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Orma\n\nOrma 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.\n\n## Installation\n\n1. Add the dependency to your `shard.yml`:\n\n   ```yaml\n   dependencies:\n     orma:\n       github: sbsoftware/orma\n   ```\n\n2. Run `shards install`\n\n## Usage\n\n```crystal\nrequire \"orma\"\n\n# ENV[\"DATABASE_URL\"] must be set\n\nclass Post \u003c Orma::Record\n  column title : String\n\n  has_many_of Comment\nend\n\nclass Comment \u003c Orma::Record\n  column body : String\n\n  belongs_to Post\nend\n\npost = Post.create(title: \"Hello\")\nComment.create(body: \"Nice post\", post_id: post.id)\n\ncomments = Comment.where(post_id: post.id)\ncomment = comments.first\ncomment.post.title # =\u003e \"Hello\"\n```\n\n## Why Orma\n\n- Define records with columns directly in Crystal\n- Query records with a compact, chainable API\n- Model relationships with `belongs_to` and `has_many`\n- Keep schema changes in sync through continuous migration\n- Work against supported database backends without centering the API around one specific adapter\n\n## Core Concepts\n\n### Records and columns\n\nDefine 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.\n\n### Query chaining\n\nRecords 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.\n\n### Associations\n\nOrma supports common record relationships such as `belongs_to` and `has_many`, so related records can be modeled directly in your domain classes.\n\n### Continuous migration\n\nContinuous migration is an experimental, yet central feature of Orma.\n\nInstead of maintaining a separate migration file for each schema change, Orma can derive and apply structural changes from your record definitions.\n\nColumn 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 `_\u003cname\u003e_deprecated` while keeping the value readable through the model.\n\nAfter 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 `_\u003cname\u003e_deprecated` column. Note that simply removing non-deprecated column definitions will leave them in the database as-is.\n\nThis is currently the built-in path for schema evolution and should be treated with appropriate care, especially in production environments.\nTo enable it, set `ENV[\"ORMA_CONTINUOUS_MIGRATION\"]=1`. Opting out of it means you'll have to take care of migrations yourself.\n\n## Supported Databases\n\nOrma currently supports:\n\n- SQLite3\n- PostgreSQL\n\n## Development\n\nRun the test suite:\n\n```bash\ncrystal spec\n```\n\n## Contributing\n\n1. Fork it (\u003chttps://github.com/sbsoftware/orma/fork\u003e)\n2. Create your feature branch (`git checkout -b my-new-feature`)\n3. Commit your changes (`git commit -am 'Add some feature'`)\n4. Push to the branch (`git push origin my-new-feature`)\n5. Create a new Pull Request\n\n## Contributors\n\n- [Stefan Bilharz](https://github.com/sbsoftware) - creator and maintainer\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsbsoftware%2Forma","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsbsoftware%2Forma","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsbsoftware%2Forma/lists"}