atom feed9 messages in org.codehaus.jruby.userRe: [jruby-user] [ANN] activerecord-j...
FromSent OnAttachments
Nick SiegerOct 2, 2009 3:22 pm 
Nick SiegerOct 2, 2009 3:25 pm 
Bob McWhirterOct 2, 2009 3:29 pm 
Stephen BannaschOct 12, 2009 10:54 pm 
Stephen BannaschOct 12, 2009 11:01 pm 
Nick SiegerOct 13, 2009 12:05 pm 
Nick SiegerOct 13, 2009 12:06 pm 
Stephen BannaschOct 13, 2009 1:30 pm 
Stephen BannaschOct 13, 2009 3:45 pm 
Subject:Re: [jruby-user] [ANN] activerecord-jdbc-adapter 0.9.2
From:Nick Sieger (nick@gmail.com)
Date:Oct 13, 2009 12:06:44 pm
List:org.codehaus.jruby.user

On Tue, Oct 13, 2009 at 1:02 AM, Stephen Bannasch <step@deanbrook.org> wrote:

Hi Nick,

I use the following form in my database.yml config:

 adapter: <% if RUBY_PLATFORM =~ /java/ %>jdbcmysql<% else %>mysql<% end %>

And I've made the following patches to my vendored 2.3.4 rails to get db:drop
and db:create to work with jdbcmysql:

diff --git a/vendor/rails/railties/lib/tasks/databases.rake
b/vendor/rails/railties/lib/tasks/databases.rake index 8b60839..faf4f0b 100644 --- a/vendor/rails/railties/lib/tasks/databases.rake +++ b/vendor/rails/railties/lib/tasks/databases.rake @@ -53,7 +53,7 @@ namespace :db do       end     rescue       case config['adapter'] -      when 'mysql' +      when /mysql/         @charset   = ENV['CHARSET']   || 'utf8'         @collation = ENV['COLLATION'] || 'utf8_unicode_ci'         begin @@ -411,7 +411,7 @@ end

 def drop_database(config)   case config['adapter'] -  when 'mysql' +  when /mysql/     ActiveRecord::Base.establish_connection(config)     ActiveRecord::Base.connection.drop_database config['database']   when /^sqlite/

Did you add any dependencies in 0.9.2 that rely on or require  running: jruby
script/generate jdbc ??

No, the "jdbc*" adapter name should still work. It's good to know that you were able to get the db:create and db:drop to work with those simple changes; maybe I'll advocate for getting those changes made to Rails so that future versions of AR-JDBC don't need to monkeypatch the rakefile so much.

/Nick