Sha256: f216d28d5d59a3d54ffb1e12c967008372df5ad55506388748d18d6b21b2d805

Contents?: true

Size: 679 Bytes

Versions: 4

Compression:

Stored size: 679 Bytes

Contents

class Create<%= namespace.camelize %><%= class_name.pluralize %> < ActiveRecord::Migration
    def change
        create_table :<%= table_name %> do |t|
<% fields.each do |attribute| -%>
<% if attribute.password_digest? -%>
            t.string :password_digest<%= attribute.inject_options %>
<% else -%>
            t.<%= attribute.type %> :<%= attribute.name %><%= attribute.inject_options %>
<% end -%>
<% end -%>
<% if options[:timestamps] %>
            t.timestamps null: false
<% end -%>
        end
<% fields_with_index.each do |attribute| -%>
        add_index :<%= table_name %>, :<%= attribute.index_name %><%= attribute.inject_index_options %>
<% end -%>
    end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
lanes-0.1.2 lib/lanes/command/templates/db/create_table_migration.rb
lanes-0.1.0 lib/lanes/command/templates/db/create_table_migration.rb
lanes-0.0.8 lib/lanes/command/templates/db/create_table_migration.rb
lanes-0.0.5 lib/lanes/command/templates/db/create_table_migration.rb