2007-02-09 09:04:31 +01:00
|
|
|
class <%= class_name.underscore.camelize %> < ActiveRecord::Migration
|
2007-12-21 08:48:59 +01:00
|
|
|
def self.up<% attributes.each do |attribute| %>
|
|
|
|
<%= migration_action %>_column :<%= table_name %>, :<%= attribute.name %><% if migration_action == 'add' %>, :<%= attribute.type %><% end -%>
|
|
|
|
<%- end %>
|
2007-01-22 14:43:50 +01:00
|
|
|
end
|
|
|
|
|
2007-12-21 08:48:59 +01:00
|
|
|
def self.down<% attributes.reverse.each do |attribute| %>
|
|
|
|
<%= migration_action == 'add' ? 'remove' : 'add' %>_column :<%= table_name %>, :<%= attribute.name %><% if migration_action == 'remove' %>, :<%= attribute.type %><% end -%>
|
|
|
|
<%- end %>
|
2007-01-22 14:43:50 +01:00
|
|
|
end
|
|
|
|
end
|