Sha256: 5fbf870ffdf30294c7c99e43b3ccc72b8c6f367015c7d36de12550fc37b416b6

Contents?: true

Size: 513 Bytes

Versions: 2

Compression:

Stored size: 513 Bytes

Contents

class <%= @activity.camelize.gsub(/\s/, '') %> < ActiveRecord::Migration<%= @class_suffix %>
  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

2 entries across 2 versions & 1 rubygems

Version Path
migrant-2.0.0 lib/generators/templates/create_migration.rb
migrant-2.0.0.pre lib/generators/templates/create_migration.rb