Sha256: 21d08018b1d63e4f583c19cf3b235b2d339b4230521563b8a0641dc3f6d12151

Contents?: true

Size: 694 Bytes

Versions: 2

Compression:

Stored size: 694 Bytes

Contents

class <%= migration_class_name %> < ActiveGroonga::Migration
  def up
<%- if migration_action -%>
    change_table(:<%= table_name %>) do |table|
  <% columns.each do |column| -%>
    <%- if migration_action == "add" -%>
      table.<%= column.create_code %>
    <%- else -%>
      table.<%= column.remove_code %>
    <%- end -%>
  <%- end -%>
    end
<%- end -%>
  end

  def down
<%- if migration_action -%>
    change_table(:<%= table_name %>) do |table|
  <% columns.reverse.each do |column| -%>
    <%- if migration_action == "add" -%>
      table.<%= column.remove_code %>
    <%- else -%>
      table.<%= column.create_code %>
    <%- end -%>
  <%- end -%>
    end
<%- end -%>
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
activegroonga-4.2.1 lib/rails/generators/active_groonga/migration/templates/migration.rb
activegroonga-4.2.0 lib/rails/generators/active_groonga/migration/templates/migration.rb