Gary Weaver
unread,Nov 29, 2012, 2:30:30 PM11/29/12Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to rubyonra...@googlegroups.com
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...