Re: [Rails-core] Some kind of automatic adding index on forgotten migrations

55 views
Skip to first unread message

Ratnadeep Deshmane

unread,
Oct 31, 2012, 7:01:31 AM10/31/12
to rubyonra...@googlegroups.com
I use rails 3.2 and by default it does add indexes if column type is specified as references.




On Tue, Oct 30, 2012 at 10:59 PM, Tino <tino.zo...@gmail.com> wrote:
Hello, just asking for first time here...

if you do in console: 

rails g migration AddReferenceidToModel type:references 

would you expect that Rails add index for reference_id field, cause it make sense always add index on field like that.

i did that on my fork and it makes me happy every time I scaffold and forgot some fields ...
:)

regards, Tino


--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group.
To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-core/-/zpRD_04wfZQJ.
To post to this group, send email to rubyonra...@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-co...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en.

tino

unread,
Oct 31, 2012, 3:49:51 PM10/31/12
to rubyonra...@googlegroups.com
i type: rails g migration AddFieldToTable field:references
result:
class AddFieldToTable < ActiveRecord::Migration
  def change
    add_column :tables, :field, :references
  end
end

there is no migrations there or i type wrong, on pgSQL, rails 3.2
Reply all
Reply to author
Forward
0 new messages