Module: Rein::Type::Enum
- Includes:
- ActiveRecord::ConnectionAdapters::Quoting
- Included in:
- ActiveRecord::Migration
- Defined in:
- lib/rein/type/enum.rb
Overview
This module contains methods for defining enum types.
Instance Method Summary collapse
- #add_enum_value(enum_name, new_value) ⇒ Object
- #create_enum_type(*args) ⇒ Object
- #drop_enum_type(*args) ⇒ Object
Instance Method Details
#add_enum_value(enum_name, new_value) ⇒ Object
23 24 25 |
# File 'lib/rein/type/enum.rb', line 23 def add_enum_value(enum_name, new_value) execute("ALTER TYPE #{enum_name} ADD VALUE #{quote(new_value)}") end |
#create_enum_type(*args) ⇒ Object
9 10 11 12 13 14 |
# File 'lib/rein/type/enum.rb', line 9 def create_enum_type(*args) reversible do |dir| dir.up do _create_enum_type(*args) end dir.down { _drop_enum_type(*args) } end end |
#drop_enum_type(*args) ⇒ Object
16 17 18 19 20 21 |
# File 'lib/rein/type/enum.rb', line 16 def drop_enum_type(*args) reversible do |dir| dir.up do _drop_enum_type(*args) end dir.down { _create_enum_type(*args) } end end |