module EnumKit::ActiveRecordExtensions::Migration::CommandRecorder
Public Instance Methods
add_enum_value(*args)
click to toggle source
Record the addition of a value to an enum type.
# File lib/enum_kit/active_record_extensions/migration/command_recorder.rb, line 35 def add_enum_value(*args) record(:add_enum_value, args) end
create_enum(*args)
click to toggle source
Record the creation of an enum type.
# File lib/enum_kit/active_record_extensions/migration/command_recorder.rb, line 17 def create_enum(*args) record(:create_enum, args) end
drop_enum(*args)
click to toggle source
Record the deletion of an enum type.
# File lib/enum_kit/active_record_extensions/migration/command_recorder.rb, line 29 def drop_enum(*args) record(:drop_enum, args) end
invert_add_enum_value(*args)
click to toggle source
Invert the addition of a value to an enum type by removing the value.
# File lib/enum_kit/active_record_extensions/migration/command_recorder.rb, line 72 def invert_add_enum_value(*args) raise ActiveRecord::IrreversibleMigration, 'add_enum_value is not reversible.' end
invert_create_enum(*args)
click to toggle source
Invert the creation of an enum type by deleting it.
# File lib/enum_kit/active_record_extensions/migration/command_recorder.rb, line 47 def invert_create_enum(*args) record(:drop_enum, args.first) end
invert_drop_enum(*args)
click to toggle source
Invert the deletion of an enum type by creating it.
Note that `drop_enum` can only be reversed if given a collection of values to call `create_enum` with as the previously deleted enum values cannot be automatically determined.
# File lib/enum_kit/active_record_extensions/migration/command_recorder.rb, line 62 def invert_drop_enum(*args) unless args.length > 1 raise ActiveRecord::IrreversibleMigration, 'drop_enum is only reversible if given an Array of values.' end record(:create_enum, args) end
invert_rename_enum(*args)
click to toggle source
Invert the renaming of an enum by renaming it back to the previous name.
# File lib/enum_kit/active_record_extensions/migration/command_recorder.rb, line 53 def invert_rename_enum(*args) record(:rename_enum, args.reverse) end
invert_rename_enum_value(*args)
click to toggle source
Invert the renaming of an enum's value by renaming it back to the previous value.
# File lib/enum_kit/active_record_extensions/migration/command_recorder.rb, line 78 def invert_rename_enum_value(*args) record(:rename_enum_value, args[0], args[2], args[1]) end
rename_enum(*args)
click to toggle source
Record the renaming of an enum type.
# File lib/enum_kit/active_record_extensions/migration/command_recorder.rb, line 23 def rename_enum(*args) record(:rename_enum, args) end
rename_enum_value(*args)
click to toggle source
Record the renaming of a value in an enum type.
# File lib/enum_kit/active_record_extensions/migration/command_recorder.rb, line 41 def rename_enum_value(*args) record(:rename_enum_value, args) end