>
> and maybe on base connection
>

Sorry- connection is an instance of the adapter, so it would already have 
these methods if they were on the adapter. (Was thinking 
ActiveRecord::Base.connection because I use that in some scripts and didn't 
stop to think that was the adapter). So the methods would be on the two 
abstract adapters, postgres and sqlite adapter I guess, and then 
schema_statements.rb would expose them as well so could be used in 
migrations.

On Thursday, November 29, 2012 2:30:30 PM UTC-5, Gary Weaver wrote:
>
> Noticed earlier that I didn't see a way to get at the currently connected 
> db server's version in an adapter (although some adapters look at the 
> version for various things, so it is there for some).
>
> What do you guys think about a new method on 
> ActiveRecord::ConnectionAdapters::AbstractAdapter called server_version to 
> return nil, and then implement in each appropriate adapter (from what I can 
> see sqlite, mysql, and pg adapters already have it but don't expose it).
>
> In addition, could add a server_type method to return nil and it would 
> return the type of database (which at least for some is currently the 
> adapter_name like "MySQL", PostgreSQL", etc.).
>
> Then could add to the migration DSL (and maybe on base connection?) to 
> expose these two as class methods (so they would call those methods on the 
> adapter), so that if you are doing DB specific things in a migration (or 
> with the base connection), the app developer could more easily add 
> constraints and use DB-specific sql.
>
> I'm sure there is a reason that this wasn't exposed before now, but I had 
> assumed this was already there and was surprised it wasn't when I looked, 
> so thought it would be worth asking about...
>

-- 
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/-/G3fmYbRuJnsJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-core?hl=en.

Reply via email to