Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rails 4 not executing rake tasks #402

Closed
avinmathew opened this issue Jan 1, 2014 · 3 comments
Closed

Rails 4 not executing rake tasks #402

avinmathew opened this issue Jan 1, 2014 · 3 comments

Comments

@avinmathew
Copy link
Contributor

I've been trying to update a Rails 3 application to Rails 4.0.2 and the last piece in the puzzle is getting it working with Oracle Enhanced 1.5.1. I've been previously using Rails 3.2.16 and Oracle Enhanced 1.4.3 without any trouble. However, I can't even execute basic rake commands on Rails 4, Oracle Enhanced 1.5.

For example, rake db:drop will simply print:

DEPRECATION WARNING: This database tasks were deprecated, because this tasks should be served by the 3rd party adapter. (called from mon_synchronize at ~/.rbenv/versions/2.1.0/lib/ruby/2.1.0/monitor.rb:211)

but it doesn't drop tables as it used to with 1.4. I believe the warning is originating from https://github.com/rails/rails/blob/4-0-stable/activerecord/lib/active_record/tasks/oracle_database_tasks.rb#L7

I had a look at https://github.com/rsim/oracle-enhanced/blob/master/lib/active_record/connection_adapters/oracle_enhanced.rake#L47 and defined?(drop_database) is nil when I run it.

@avinmathew
Copy link
Contributor Author

Doing a bit more digging, it looks like Rails will remove oracle_database_tasks.rb from 4.1: rails/rails@42d0d18

It also looks like Rails 4 doesn't use the global create_database and drop_database methods anymore and now requires registration process (register_task in DatabaseTasks). My current assumption is that Oracle Enhanced isn't hooking in correctly to Rails 4 DatabaseTasks correctly and that's why it's not working.

Interestingly enough, if I run using JRuby rather than MRI, and also include activerecord-jdbc-adapter in addition to Oracle Enhanced, everything seems to run fine. I'm guessing since ARJDBC defines compatible tasks for Oracle: https://github.com/jruby/activerecord-jdbc-adapter/blob/master/lib/arjdbc/tasks/oracle_database_tasks.rb

@yahonda
Copy link
Collaborator

yahonda commented Jan 5, 2014

Thanks for the report.

create_database was removed by rails/rails@e678d41#diff-28a5ae383b291583c513ad8eeed99a3a and also drop_database was remove dby rails/rails@bca52b0#diff-28a5ae383b291583c513ad8eeed99a3a

Now I'm taking a look at this issue, if you have pull requests available it would be welcomed.

avinmathew pushed a commit to avinmathew/oracle-enhanced that referenced this issue Jan 6, 2014
yahonda added a commit that referenced this issue Jan 24, 2014
Support Rails 4 Database Tasks - Fixes #402
@yahonda
Copy link
Collaborator

yahonda commented Jan 24, 2014

Closed as #404 merged to master. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants