Sha256: 88c98e164648fd02cf1bcce84ebb36e18128be0f5e818eb03084eb3038c61706
Contents?: true
Size: 828 Bytes
Versions: 4
Compression:
Stored size: 828 Bytes
Contents
class <%= class_name %>Migration < ActiveRecord::Migration def self.up create_table :<%= table_name %><%= ', :id => false' if !auto %><%= ', :options => "%s"' % options if options %> do |t| <% for field in fields %> t.<%= field['type'] %> :<%= field['field'] %><%= ', :limit => %s' % field['size'] if field['size'] %><%= ', :default => "%s"' % field['default'] if field['default'] %><%= "\n" %> <% end %> end <% if primaries.size > 0 and !auto %> execute "ALTER TABLE <%= table_name %> ADD PRIMARY KEY (<%= primaries.collect {|p| "%s, " % p }.to_s.strip.chop %>)" <% end %> <% indexes.each do |index| %> add_index :<%= table_name %>, [<%= index['index'].collect {|i| ":%s" % i }.join(", ") %>] <% end %> end def self.down drop_table :<%= table_name %><%= "\n" %> end end
Version data entries
4 entries across 4 versions & 1 rubygems