Module: ActiveRecord::PostgresEnum::CommandRecorder

Defined in:
lib/active_record/postgres_enum/command_recorder.rb

Instance Method Summary collapse

Instance Method Details

#create_enum(name, values, _opts = nil) ⇒ Object



6
7
8
# File 'lib/active_record/postgres_enum/command_recorder.rb', line 6

def create_enum(name, values, _opts = nil)
  record(:create_enum, [name, values])
end

#invert_create_enum(args) ⇒ Object



10
11
12
# File 'lib/active_record/postgres_enum/command_recorder.rb', line 10

def invert_create_enum(args)
  [:drop_enum, args.first]
end

#invert_rename_enum(args) ⇒ Object



18
19
20
# File 'lib/active_record/postgres_enum/command_recorder.rb', line 18

def invert_rename_enum(args)
  [:rename_enum, args.reverse]
end

#invert_rename_enum_value(args) ⇒ Object



26
27
28
# File 'lib/active_record/postgres_enum/command_recorder.rb', line 26

def invert_rename_enum_value(args)
  [:rename_enum_value, [args.first] + args.last(2).reverse]
end

#rename_enum(name, new_name) ⇒ Object



14
15
16
# File 'lib/active_record/postgres_enum/command_recorder.rb', line 14

def rename_enum(name, new_name)
  record(:rename_enum, [name, new_name])
end

#rename_enum_value(name, existing_value, new_value) ⇒ Object



22
23
24
# File 'lib/active_record/postgres_enum/command_recorder.rb', line 22

def rename_enum_value(name, existing_value, new_value)
  record(:rename_enum_value, [name, existing_value, new_value])
end