Skip to content
This repository has been archived by the owner on Apr 26, 2019. It is now read-only.

Allow updating the value of an enum column #10

Open
direction opened this issue Oct 8, 2013 · 1 comment
Open

Allow updating the value of an enum column #10

direction opened this issue Oct 8, 2013 · 1 comment

Comments

@direction
Copy link

Something along the lines of

class Table
  ... 
  def change(old_value, new_value)
    @connection.execute "UPDATE #{@connection.quote_table_name @name}
    SET value = #{@connection.quote old_value} WHERE value = #{@connection.quote new_value}"
  end
end

in https://github.com/howaboutwe/enum_table/blob/master/lib/enum_table/schema_statements.rb#L66

@oggy
Copy link
Contributor

oggy commented Oct 9, 2013

@direction

I dig it - except I'd probably call it rename to feel a little more analogous with {add,remove,rename}_column.

Feel like sending a pull request w/ test? :)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants