Sha256: 07dbf22f914a056f0b82941cb4f0903317da6856577dea897f1fb6c6b5457425

Contents?: true

Size: 660 Bytes

Versions: 10

Compression:

Stored size: 660 Bytes

Contents

class <%= migration_class_name %> < ActiveRecord::Migration
  def change
    create_table :<%= table_name %> do |t|
<% attributes.each do |attribute| -%>
<% if attribute.password_digest? -%>
      t.string :password_digest<%= attribute.inject_options %>
<% elsif !%w(asset content).include?(attribute.type.to_s) -%>
      t.<%= attribute.type %> :<%= attribute.name %><%= attribute.inject_options %>
<% end -%>
<% end -%>
<% if options[:timestamps] %>
      t.timestamps
<% end -%>
    end
<% attributes_with_index.each do |attribute| -%>
    add_index :<%= table_name %>, :<%= attribute.index_name %><%= attribute.inject_index_options %>
<% end -%>
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
tenon-2.1.0 lib/templates/migration/templates/create_table_migration.rb
tenon-2.0.8 lib/templates/migration/templates/create_table_migration.rb
tenon-2.0.7 lib/templates/migration/templates/create_table_migration.rb
tenon-2.0.6 lib/templates/migration/templates/create_table_migration.rb
tenon-2.0.5 lib/templates/migration/templates/create_table_migration.rb
tenon-2.0.4 lib/templates/migration/templates/create_table_migration.rb
tenon-2.0.3 lib/templates/migration/templates/create_table_migration.rb
tenon-2.0.2 lib/templates/migration/templates/create_table_migration.rb
tenon-2.0.1 lib/templates/migration/templates/create_table_migration.rb
tenon-2.0.0 lib/templates/migration/templates/create_table_migration.rb