Sha256: 7c7b2d810c3ed5701df3d5f2eb584ac86b434743e5e0f1b8f3cd6226069c8ba5

Contents?: true

Size: 686 Bytes

Versions: 12

Compression:

Stored size: 686 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

12 entries across 12 versions & 1 rubygems

Version Path
activegroonga-4.0.0 lib/rails/generators/active_groonga/migration/templates/migration.rb
activegroonga-2.1.4 lib/rails/generators/active_groonga/migration/templates/migration.rb
activegroonga-2.1.3 lib/rails/generators/active_groonga/migration/templates/migration.rb
activegroonga-2.1.2 lib/rails/generators/active_groonga/migration/templates/migration.rb
activegroonga-2.1.1 lib/rails/generators/active_groonga/migration/templates/migration.rb
activegroonga-1.0.7 lib/rails/generators/active_groonga/migration/templates/migration.rb
activegroonga-1.0.6 lib/rails/generators/active_groonga/migration/templates/migration.rb
activegroonga-1.0.5 lib/rails/generators/active_groonga/migration/templates/migration.rb
activegroonga-1.0.4 lib/rails/generators/active_groonga/migration/templates/migration.rb
activegroonga-1.0.3 lib/rails/generators/active_groonga/migration/templates/migration.rb
activegroonga-1.0.1 lib/rails/generators/active_groonga/migration/templates/migration.rb
activegroonga-1.0.0 lib/rails/generators/active_groonga/migration/templates/migration.rb