{"id":13483748,"url":"https://github.com/luckyframework/avram","last_synced_at":"2025-04-12T15:43:00.600Z","repository":{"id":34782309,"uuid":"168843741","full_name":"luckyframework/avram","owner":"luckyframework","description":"A Crystal database wrapper for reading, writing, and migrating Postgres databases.","archived":false,"fork":false,"pushed_at":"2025-04-11T21:50:05.000Z","size":27407,"stargazers_count":167,"open_issues_count":211,"forks_count":64,"subscribers_count":9,"default_branch":"main","last_synced_at":"2025-04-11T22:36:48.497Z","etag":null,"topics":["crystal","hacktoberfest","lucky-framework","orm"],"latest_commit_sha":null,"homepage":"https://luckyframework.github.io/avram/","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/luckyframework.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","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":"2019-02-02T15:07:51.000Z","updated_at":"2025-04-11T21:48:46.000Z","dependencies_parsed_at":"2023-02-15T17:45:43.110Z","dependency_job_id":"d6f0ee86-47da-422b-9885-dfcc9243fe23","html_url":"https://github.com/luckyframework/avram","commit_stats":null,"previous_names":[],"tags_count":54,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luckyframework%2Favram","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luckyframework%2Favram/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luckyframework%2Favram/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luckyframework%2Favram/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/luckyframework","download_url":"https://codeload.github.com/luckyframework/avram/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248590933,"owners_count":21129916,"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":["crystal","hacktoberfest","lucky-framework","orm"],"created_at":"2024-07-31T17:01:14.866Z","updated_at":"2025-04-12T15:43:00.558Z","avatar_url":"https://github.com/luckyframework.png","language":"Crystal","funding_links":[],"categories":["Crystal","ORM/ODM Extensions"],"sub_categories":[],"readme":"# Avram\n\n[![API Documentation Website](https://img.shields.io/website?down_color=red\u0026down_message=Offline\u0026label=API%20Documentation\u0026up_message=Online\u0026url=https%3A%2F%2Fluckyframework.github.io%2Favram%2F)](https://luckyframework.github.io/avram)\n\nDatabase ORM built for the [Lucky Framework](https://luckyframework.org/) written in Crystal. Supporting PostgreSQL 12+ and based off principals of [Elixir Ecto](https://hexdocs.pm/ecto/Ecto.html) and [Rails ActiveRecord](https://guides.rubyonrails.org/active_record_basics.html).\n\n### Why Avram?\n\nThe name comes from [Henriette Avram](https://en.wikipedia.org/wiki/Henriette_Avram).\n\n\u003e Henriette Davidson Avram (October 7, 1919 – April 22, 2006) was a computer programmer and systems analyst who developed the MARC format (Machine Readable Cataloging), the international data standard for bibliographic and holdings information in libraries.\n\n## Installation\n\nAdd this to your application's `shard.yml`:\n\n```yaml\ndependencies:\n  avram:\n    github: luckyframework/avram\n```\n\n## Usage\n\n```crystal\nrequire \"avram\"\n\n# Define your database\nclass AppDatabase \u003c Avram::Database\nend\n\nAppDatabase.configure do |settings|\n  settings.credentials = Avram::Credentials.new(\n    database: \"my_app_development\",\n    username: \"postgres\",\n    hostname: \"localhost\",\n    password: \"password\",\n    port: 5432,\n  )\nend\n\n# Configure Avram to use your database\nAvram.configure do |settings|\n  settings.database_to_migrate = AppDatabase\n\n  # When `true`, allow lazy loading (N+1).\n  # If `false` raise an error if you forget to preload associations\n  settings.lazy_load_enabled = true\n  settings.query_cache_enabled = false\nend\n\n# Create your read-only model\nclass Person \u003c Avram::Model\n  def self.database : Avram::Database.class\n    AppDatabase\n  end\n\n  table :people do\n    column name : String\n    column age : Int32\n    column programmer : Bool = true\n  end\nend\n\n# Insert a new record\nPerson::SaveOperation.create!(name: \"Henriette Davidson Avram\", age: 86)\n# Query for a record\nperson = Person::BaseQuery.new.name.ilike(\"%avram\")\nperson.programmer? #=\u003e true\n```\n\nFor more details, read the [guides](https://luckyframework.org/guides/database/intro-to-avram-and-orms).\n\n## Contributing\n\n1. Fork it ( https://github.com/luckyframework/avram/fork )\n1. Create your feature branch (git checkout -b my-new-feature)\n1. Make your changes\n1. Run specs `crystal spec`\n1. Check formatting `crystal tool format spec/ src/`\n1. Check ameba `./bin/ameba`\n1. Commit your changes (git commit -am 'Add some feature')\n1. Push to the branch (git push origin my-new-feature)\n1. Create a new Pull Request\n\n\u003e Docker is provided for quick setup and testing. You can run `./script/setup` and `./script/test` for ease.\n\n## Contributors\n\n[paulcsmith](https://github.com/paulcsmith) Paul Smith - Original Creator of Lucky\n\n\u003ca href=\"https://github.com/luckyframework/avram/graphs/contributors\"\u003e\n  \u003cimg src=\"https://contrib.rocks/image?repo=luckyframework/avram\" /\u003e\n\u003c/a\u003e\n\nMade with [contrib.rocks](https://contrib.rocks).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fluckyframework%2Favram","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fluckyframework%2Favram","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fluckyframework%2Favram/lists"}