Sha256: 65707a2c108a1c0eef4214ca9c5ce1e56205769ae583ea3ca89441244c351ae9

Contents?: true

Size: 622 Bytes

Versions: 48

Compression:

Stored size: 622 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 %>
<% else -%>
      t.<%= attribute.type %> :<%= attribute.name %><%= attribute.inject_options %>
<% end -%>
<% end -%>
<% if options[:timestamps] %>
      t.timestamps null: false
<% 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

48 entries across 47 versions & 8 rubygems

Version Path
activerecord-4.2.11.3 lib/rails/generators/active_record/migration/templates/create_table_migration.rb
activerecord-4.2.11.2 lib/rails/generators/active_record/migration/templates/create_table_migration.rb
activerecord-4.2.11.1 lib/rails/generators/active_record/migration/templates/create_table_migration.rb
activerecord-4.2.11 lib/rails/generators/active_record/migration/templates/create_table_migration.rb
activerecord-4.2.10 lib/rails/generators/active_record/migration/templates/create_table_migration.rb
activerecord-4.2.10.rc1 lib/rails/generators/active_record/migration/templates/create_table_migration.rb
activerecord-4.2.9 lib/rails/generators/active_record/migration/templates/create_table_migration.rb
activerecord-4.2.9.rc2 lib/rails/generators/active_record/migration/templates/create_table_migration.rb
activerecord-4.2.9.rc1 lib/rails/generators/active_record/migration/templates/create_table_migration.rb
enju_leaf-1.2.1 vendor/bundle/ruby/2.3/gems/activerecord-4.2.8/lib/rails/generators/active_record/migration/templates/create_table_migration.rb
activerecord-4.2.8 lib/rails/generators/active_record/migration/templates/create_table_migration.rb
activerecord-4.2.8.rc1 lib/rails/generators/active_record/migration/templates/create_table_migration.rb
activerecord-4.2.7.1 lib/rails/generators/active_record/migration/templates/create_table_migration.rb
activerecord-4.2.7 lib/rails/generators/active_record/migration/templates/create_table_migration.rb
activerecord-4.2.7.rc1 lib/rails/generators/active_record/migration/templates/create_table_migration.rb
ish_lib_manager-0.0.1 test/dummy/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.6/lib/rails/generators/active_record/migration/templates/create_table_migration.rb
activerecord-4.2.6 lib/rails/generators/active_record/migration/templates/create_table_migration.rb
activerecord-4.2.6.rc1 lib/rails/generators/active_record/migration/templates/create_table_migration.rb
activerecord-4.2.5.2 lib/rails/generators/active_record/migration/templates/create_table_migration.rb
activejob-lock-0.0.2 rails/activerecord/lib/rails/generators/active_record/migration/templates/create_table_migration.rb