Sha256: 94f7cc4fdf74efab4a65c0eb13f36590a920f7ae1474af5c0224570b82355278
Contents?: true
Size: 979 Bytes
Versions: 5
Compression:
Stored size: 979 Bytes
Contents
class <%= migration_class_name %> < ActiveRecord::Migration def change <%- if !model.schema.table_exists? -%> create_table :<%= model.table_name %> <%- end -%> <%- 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
5 entries across 5 versions & 1 rubygems