Sha256: 6043b234077162349625884e7dfb32ae4355e7dd8aa05e35dcc620230dbf94ff
Contents?: true
Size: 1 KB
Versions: 7
Compression:
Stored size: 1 KB
Contents
class <%= migration_class_name %> < ActiveRecord::Migration def change <%- if !model.schema.table_exists? -%> create_table :<%= model.schema.prefixed_table_name %> <%- end -%> <%- model.schema.diff(:fields, :add).each do |field| -%> add_column :<%= model.schema.prefixed_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.schema.prefixed_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
7 entries across 6 versions & 1 rubygems