{"id":13411718,"url":"https://github.com/bibendi/activerecord-postgres_enum","last_synced_at":"2025-05-15T15:00:23.154Z","repository":{"id":45288542,"uuid":"155377349","full_name":"bibendi/activerecord-postgres_enum","owner":"bibendi","description":"Integrate PostgreSQL's enum data type into ActiveRecord's schema and migrations.","archived":false,"fork":false,"pushed_at":"2024-06-13T09:47:34.000Z","size":114,"stargazers_count":364,"open_issues_count":4,"forks_count":25,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-11T22:38:11.763Z","etag":null,"topics":["activerecord","enum","postgres","postgresql","rails","ruby"],"latest_commit_sha":null,"homepage":null,"language":"Ruby","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/bibendi.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","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":"2018-10-30T11:55:04.000Z","updated_at":"2025-01-26T21:53:03.000Z","dependencies_parsed_at":"2024-04-10T13:54:02.693Z","dependency_job_id":"97070db3-6be3-4c17-84a6-fd605c94a371","html_url":"https://github.com/bibendi/activerecord-postgres_enum","commit_stats":{"total_commits":60,"total_committers":12,"mean_commits":5.0,"dds":"0.33333333333333337","last_synced_commit":"d816594e8ae8ca3b46b6879645776439211bfdad"},"previous_names":[],"tags_count":23,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bibendi%2Factiverecord-postgres_enum","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bibendi%2Factiverecord-postgres_enum/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bibendi%2Factiverecord-postgres_enum/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bibendi%2Factiverecord-postgres_enum/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bibendi","download_url":"https://codeload.github.com/bibendi/activerecord-postgres_enum/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254364264,"owners_count":22058877,"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":["activerecord","enum","postgres","postgresql","rails","ruby"],"created_at":"2024-07-30T20:01:16.129Z","updated_at":"2025-05-15T15:00:23.053Z","avatar_url":"https://github.com/bibendi.png","language":"Ruby","readme":"[![Gem Version](https://badge.fury.io/rb/activerecord-postgres_enum.svg)](https://badge.fury.io/rb/activerecord-postgres_enum)\n[![Build Status](https://github.com/bibendi/activerecord-postgres_enum/workflows/Ruby/badge.svg?branch=master)](https://github.com/bibendi/activerecord-postgres_enum/actions?query=branch%3Amaster)\n\n# ActiveRecord::PostgresEnum\n\nAdds migration and schema.rb support to PostgreSQL enum data types.\n\n\u003ca href=\"https://evilmartians.com/?utm_source=activerecord-postgres_enum\"\u003e\n\u003cimg src=\"https://evilmartians.com/badges/sponsored-by-evil-martians.svg\" alt=\"Sponsored by Evil Martians\" width=\"236\" height=\"54\"\u003e\u003c/a\u003e\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'activerecord-postgres_enum'\n```\n\nAnd then execute:\n\n    $ bundle\n\nOr install it yourself as:\n\n    $ gem install activerecord-postgres_enum\n\n## Usage\n\n### Migrations\n\n```ruby\ncreate_enum :mood, %w(happy great been_better)\n\ncreate_table :person do\n  t.enum :person_mood, enum_type: :mood\nend\n```\n\nRunning the above will create a table :person, with a column :person_mood of type :mood. This will also be saved on schema.rb so that `rake db:schema:load` works as expected.\n\nTo drop an existing enum:\n\n```ruby\ndrop_enum :mood\n```\n\nTo rename an existing enum:\n\n```ruby\nrename_enum :mood, :emotions\n```\n\nTo add a value into existing enum:\n\n```ruby\nadd_enum_value :mood, \"pensive\"\n```\n\nTo remove a value from existing enum:\n\n\u003e :warning: Make sure that value is not used anywhere in the database.\n\n```ruby\nremove_enum_value :mood, \"pensive\"\n```\n\nTo add a new enum column to an existing table:\n\n```ruby\ndef change\n  create_enum :product_type, %w[one-off subscription]\n\n  add_column :products, :type, :product_type\nend\n```\n\nTo rename a value:\n\n```ruby\nrename_enum_value :mood, \"pensive\", \"wistful\"\n```\n\n**NB:** To stop Postgres complaining about adding enum values inside a transaction, use [`disable_ddl_transaction!`](https://api.rubyonrails.org/classes/ActiveRecord/Migration.html#method-c-disable_ddl_transaction-21) in your migration.\n\n\n## Development\n\nAfter checking out the repo, run `bin/setup` to install dependencies. Then, run `rspec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.\n\nTo install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at https://github.com/bibendi/activerecord-postgres_enum. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.\n\n## License\n\nThe gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).\n\n## Code of Conduct\n\nEveryone interacting in the Activerecord::PostgresEnum project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/bibendi/activerecord-postgres_enum/blob/master/CODE_OF_CONDUCT.md).\n","funding_links":[],"categories":["Ruby","Gems"],"sub_categories":["Articles"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbibendi%2Factiverecord-postgres_enum","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbibendi%2Factiverecord-postgres_enum","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbibendi%2Factiverecord-postgres_enum/lists"}