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 rubyonrails-core@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en.
Ratnadeep Deshmane
2012-Oct-31 11:01 UTC
Re: Some kind of automatic adding index on forgotten migrations
I use rails 3.2 and by default it does add indexes if column type is specified as references. -- Ratnadeep Deshmane. http://appsurfer.com http://rainingclouds.com http://twitter.com/rtdp On Tue, Oct 30, 2012 at 10:59 PM, Tino <tino.zorotovic@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 rubyonrails-core@googlegroups.com. > To unsubscribe from this group, send email to > rubyonrails-core+unsubscribe@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/rubyonrails-core?hl=en. >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en.
tino
2012-Oct-31 19:49 UTC
Re: Some kind of automatic adding index on forgotten migrations
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
On Wednesday, October 31, 2012 12:01:31 PM UTC+1, rtdp
wrote:>
> I use rails 3.2 and by default it does add indexes if column type is
> specified as references.
>
> --
> Ratnadeep Deshmane.
> http://appsurfer.com
> http://rainingclouds.com
> http://twitter.com/rtdp
>
>
>
> On Tue, Oct 30, 2012 at 10:59 PM, Tino <tino.zo...@gmail.com
<javascript:>
> > 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<javascript:>
>> .
>> To unsubscribe from this group, send email to
>> rubyonrails-co...@googlegroups.com <javascript:>.
>> For more options, visit this group at
>> http://groups.google.com/group/rubyonrails-core?hl=en.
>>
>
>
--
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/-/FCfWbVmMXB4J.
To post to this group, send email to rubyonrails-core@googlegroups.com.
To unsubscribe from this group, send email to
rubyonrails-core+unsubscribe@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/rubyonrails-core?hl=en.