Sha256: 871381abab1c5d7f5ffa5594a2f397e3442d2f1fb0c883a14e396c89e9821f25

Contents?: true

Size: 484 Bytes

Versions: 3

Compression:

Stored size: 484 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| %>
    add_index :<%= @table_name %>, <%= index.inspect %>
  	<% end -%>
  end
  
  def self.down
    drop_table :<%= @table_name %>
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
migrant-1.2.1 lib/generators/templates/create_migration.erb
migrant-1.2.0 lib/generators/templates/create_migration.erb
migrant-1.1.2 lib/generators/templates/create_migration.erb