Sha256: ae4a7d7610757a8014f910556220e8bfa2f22c10e337eb0f855536b974124348
Contents?: true
Size: 885 Bytes
Versions: 4
Compression:
Stored size: 885 Bytes
Contents
class <%= migration_class_name %> < ActiveRecord::Migration def change <%- model.schema.diff(:fields, :add).each do |field| -%> add_column :<%= model.table_name %>, <%= field.name.inspect %>, <%= field.type.inspect %><%= ", #{field.options.inspect}" if !field.options.blank? %> <%- end -%> <%- model.schema.diff(:indexes, :add).each do |index| -%> add_index :<%= model.table_name %>, <%= index.name.inspect %><%= ", #{index.options.inspect}" if !index.options.blank? %> <%- end -%> <%- model.schema.diff(:joins, :add).each do |join| -%> create_table :<%= join.table %>, :id => false do |t| t.integer <%= join.key1.inspect %> t.integer <%= join.key2.inspect %> end <%- if join.index -%> add_index :<%= join.table %>, <%= join.key1.inspect %> add_index :<%= join.table %>, <%= join.key2.inspect %> <%- end -%> <%- end -%> end end
Version data entries
4 entries across 4 versions & 1 rubygems