Sha256: 0810e1630fb8e24639ad676372b31c1847c70ba02b1a02f16256fdde54035139

Contents?: true

Size: 588 Bytes

Versions: 6

Compression:

Stored size: 588 Bytes

Contents

class <%=@migration.camelize %><%=@table_name.camelize %> < ActiveRecord::Migration
  def self.up
    <% @add_columns.each do |col| %>
      add_column :<%=@table_name %>, :<%=col.name %>, :<%=col.type %>
    <% end %>
    <% @drop_columns.each do |col| %>
      remove_column :<%=@table_name %>, :<%=col.name %>
    <% end %>
  end
  def self.down
    <% @drop_columns.each do |col| %>
      add_column :<%=@table_name %>, :<%=col.name %>, :<%=col.type %>
    <% end %>
    <% @add_columns.each do |col| %>
      remove_column :<%=@table_name %>, :<%=col.name %>
    <% end %>
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
flatten_record-1.0.6 lib/generators/flatten_record/migration/templates/update.erb
flatten_record-1.0.5 lib/generators/flatten_record/migration/templates/update.erb
flatten_record-1.0.4 lib/generators/flatten_record/migration/templates/update.erb
flatten_record-1.0.3 lib/generators/flatten_record/migration/templates/update.erb
flatten_record-1.0.2 lib/generators/flatten_record/migration/templates/update.erb
flatten_record-1.0.1 lib/generators/flatten_record/migration/templates/update.erb