Sha256: 52e248f5f9f72f4b65d9a55cf1c1b421af71264e972463c84cbfe9e70e0c702d

Contents?: true

Size: 534 Bytes

Versions: 7

Compression:

Stored size: 534 Bytes

Contents

class <%= @activity.camelize.gsub(/\s/, '') %> < ActiveRecord::Migration
  def self.up
    create_table :<%= @table_name %> do |t|
      <% @columns.each do |field, options| %>
      t.<%= options.delete(:type) %> :<%= field %><%= (options.blank?)? '': ", "+options.to_a.collect { |o| ":#{o[0]}=>#{o[1].inspect}" }.sort.join(', ') %> 
      <% end %>
    end
    <% @indexes.each do |index| %>
    add_index :<%= @table_name %>, <%= index.inspect %>
  	<% end -%>
  end
  
  def self.down
    drop_table :<%= @table_name %>
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
migrant-1.5.0 lib/generators/templates/create_migration.erb
migrant-1.4.3 lib/generators/templates/create_migration.erb
migrant-1.4.1 lib/generators/templates/create_migration.erb
migrant-1.4.0 lib/generators/templates/create_migration.erb
migrant-1.3.2 lib/generators/templates/create_migration.erb
migrant-1.3.1 lib/generators/templates/create_migration.erb
migrant-1.3.0 lib/generators/templates/create_migration.erb