All Projects → bibendi → Activerecord Postgres_enum

bibendi / Activerecord Postgres_enum

Licence: mit
Integrate PostgreSQL's enum data type into ActiveRecord's schema and migrations.

Programming Languages

ruby
36898 projects - #4 most used programming language
enum
40 projects

Projects that are alternatives of or similar to Activerecord Postgres enum

Activerecord Clean Db Structure
Automatic cleanup for the Rails db/structure.sql file (ActiveRecord/PostgreSQL)
Stars: ✭ 101 (-55.51%)
Mutual labels:  activerecord, postgresql, postgres, rails
Ar Uuid
Override migration methods to support UUID columns without having to be explicit about it.
Stars: ✭ 41 (-81.94%)
Mutual labels:  activerecord, postgresql, postgres, rails
Pg party
ActiveRecord PostgreSQL Partitioning
Stars: ✭ 294 (+29.52%)
Mutual labels:  activerecord, postgresql, postgres, rails
Zero downtime migrations
Zero downtime migrations with ActiveRecord 3+ and PostgreSQL
Stars: ✭ 513 (+125.99%)
Mutual labels:  activerecord, postgres, rails
Scenic
Scenic is maintained by Derek Prior, Caleb Hearth, and you, our contributors.
Stars: ✭ 2,856 (+1158.15%)
Mutual labels:  activerecord, postgres, rails
Rails Pg Extras
Rails PostgreSQL database performance insights. Locks, index usage, buffer cache hit ratios, vacuum stats and more.
Stars: ✭ 432 (+90.31%)
Mutual labels:  activerecord, postgresql, rails
With advisory lock
Advisory locking for ActiveRecord
Stars: ✭ 409 (+80.18%)
Mutual labels:  activerecord, postgresql, postgres
Activerecord Postgis Adapter
ActiveRecord connection adapter for PostGIS, based on postgresql and rgeo
Stars: ✭ 746 (+228.63%)
Mutual labels:  activerecord, postgresql, rails
Mobility
Pluggable Ruby translation framework
Stars: ✭ 644 (+183.7%)
Mutual labels:  activerecord, postgresql, rails
Activerecordextended
Adds additional postgres functionality to an ActiveRecord / Rails application
Stars: ✭ 830 (+265.64%)
Mutual labels:  activerecord, postgres, rails
Niklick
Rails Versioned API solution template for hipsters! (Ruby, Ruby on Rails, REST API, GraphQL, Docker, RSpec, Devise, Postgress DB)
Stars: ✭ 39 (-82.82%)
Mutual labels:  postgresql, postgres, rails
Logidze
Database changes log for Rails
Stars: ✭ 1,060 (+366.96%)
Mutual labels:  activerecord, postgresql, rails
Rein
Database constraints made easy for ActiveRecord.
Stars: ✭ 657 (+189.43%)
Mutual labels:  activerecord, postgres, rails
Monogamy
Add table-level database locking to ActiveRecord
Stars: ✭ 12 (-94.71%)
Mutual labels:  activerecord, postgresql, postgres
Calculate All
calculate_all method for aggregate functions in Active Record
Stars: ✭ 118 (-48.02%)
Mutual labels:  activerecord, postgres, rails
Torque Postgresql
Add support to complex resources of PostgreSQL, like data types, array associations, and auxiliary statements (CTE)
Stars: ✭ 130 (-42.73%)
Mutual labels:  activerecord, postgresql, rails
Ruby2 Rails4 Bootstrap Heroku
A starter application based on Ruby 2.4, Rails 4.2 and Bootstrap for Sass 3, deployable on Heroku
Stars: ✭ 181 (-20.26%)
Mutual labels:  postgresql, rails
Imgsmlr
Similar images search for PostgreSQL
Stars: ✭ 181 (-20.26%)
Mutual labels:  postgresql, postgres
Ooor
Odoo Ruby JSON client. Emulates ActiveRecord enough (as much as Mongoid; Implements ActiveModel) to make Rails development with an Odoo datastore straightforward
Stars: ✭ 184 (-18.94%)
Mutual labels:  activerecord, rails
Datoji
A tiny JSON storage service. Create, Read, Update, Delete and Search JSON data.
Stars: ✭ 222 (-2.2%)
Mutual labels:  postgresql, rails

Gem Version Build Status

ActiveRecord::PostgresEnum

Adds migration and schema.rb support to PostgreSQL enum data types.

Sponsored by Evil Martians

Installation

Add this line to your application's Gemfile:

gem 'activerecord-postgres_enum'

And then execute:

$ bundle

Or install it yourself as:

$ gem install activerecord-postgres_enum

Usage

Migrations

create_enum :mood, %w(happy great been_better)

create_table :person do
  t.enum :person_mood, enum_name: :mood
end

Running 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 schema:load works as expected.

To drop an existing enum:

drop_enum :mood

To rename an existing enum:

rename_enum :mood, :emotions

To add a value into existing enum:

add_enum_value :mood, "pensive"

To remove a value from existing enum:

⚠️ Make sure that value is not used anywhere in the database.

remove_enum_value :mood, "pensive"

To add a new enum column to an existing table:

def change
  create_enum :product_type, %w[one-off subscription]

  add_column :products, :type, :product_type
end

To rename a value:

rename_enum_value :mood, "pensive", "wistful"

NB: To stop Postgres complaining about adding enum values inside a transaction, use disable_ddl_transaction! in your migration.

Development

After checking out the repo, run bin/setup to install dependencies. Then, run rake spec to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.

To 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.

Contributing

Bug 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 code of conduct.

License

The gem is available as open source under the terms of the MIT License.

Code of Conduct

Everyone interacting in the Activerecord::PostgresEnum project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].