Sha256: 3fd70a64bd3314e00d1ab1df1a9eba0357889911a9b3d74bfab9c9994b3d3667

Contents?: true

Size: 493 Bytes

Versions: 14

Compression:

Stored size: 493 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.inspect[1..-2] %> 
      <% end %>
    end
    <% @indexes.each do |index, options| %>
    add_index :<%= @table_name %>, <%= index.inspect %>
  	<% end -%>
  end
  
  def self.down
    drop_table :<%= @table_name %>
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
migrant-1.5.0 lib/generators/templates/create_migration.rb
migrant-1.4.3 lib/generators/templates/create_migration.rb
migrant-1.4.1 lib/generators/templates/create_migration.rb
migrant-1.4.0 lib/generators/templates/create_migration.rb
migrant-1.3.2 lib/generators/templates/create_migration.rb
migrant-1.3.1 lib/generators/templates/create_migration.rb
migrant-1.3.0 lib/generators/templates/create_migration.rb
migrant-1.2.8 lib/generators/templates/create_migration.rb
migrant-1.2.7 lib/generators/templates/create_migration.rb
migrant-1.2.5 lib/generators/templates/create_migration.rb
migrant-1.2.2 lib/generators/templates/create_migration.rb
migrant-1.2.1 lib/generators/templates/create_migration.rb
migrant-1.2.0 lib/generators/templates/create_migration.rb
migrant-1.1.2 lib/generators/templates/create_migration.rb