rake db:create doesn't work on JDBC/PostgreSQL
----------------------------------------------
Key: JRUBY-2715
URL: http://jira.codehaus.org/browse/JRUBY-2715
Project: JRuby
Issue Type: Bug
Components: ActiveRecord-JDBC
Affects Versions: JRuby 1.1.2
Environment: Solaris 10u4 x86, PostgreSQL 8.2, JRuby 1.1.2, JDK
1.6.0_06, NetBeans 6.5 latest nightly builds, make sure the logged in user has
PostgreSQL createdb rights and that there is a database matching that username.
PSQL w/ no arguments should work properly in otherwords. It should not say
"Database "username" does not exist."
Reporter: Peter Williams
Priority: Minor
Add activerecord-jdbcpostgresql-adapter gem (v 0.8.2) to gems used by NetBeans
JRuby 1.1.2 install. This will also upgrade the activerecord-jdbc-adaptor gem
to 0.8.2
Create new Rails project (Rails 2.1.0 IIRC), any server. Select JDBC,
PostgreSQL, enter username, no password, on db page.
Modify database.yml to use jdbcpostgres adapter
Make sure the database required by the project does not yet exist.
Run rake db:create
It will run w/o visible errors
Check to see if database was created -- it won't be.
I debugged this extensively and what it resolved to in my case was this:
In jdbc.rake, around line 33, the code tries to create the database with this
line:
ActiveRecord::Base.connection.create_database(config['database'])
It was throwing a no such method exception because the JdbcAdapter instance
referenced by ActiveRecord::Base.connection did not define a create_database
method.
I also noted that jdbc_postgres.rb does not define this method. When I added a
definition of create_database to this file, the rake task succeeded as expected.
rake db:drop has similar issues as I suspect do some of the other jdbc adapters.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email