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

structure_drop creating, but not executing, sql to drop schema #18

Closed
svesely opened this issue Jul 7, 2010 · 2 comments
Closed

structure_drop creating, but not executing, sql to drop schema #18

svesely opened this issue Jul 7, 2010 · 2 comments

Comments

@svesely
Copy link

svesely commented Jul 7, 2010

I was having issues where rake db:drop wouldn't actually drop either table or sequence, so I dug into the code to find where oracle-enhanced was dropping these items.

I found structure_drop, which seems to fit my needs exactly. However, when I run:
ActiveRecord::Base.connection.structure_drop

I'm getting back the SQL to drop all the tables, returned as a long string, but it's not actually executed. When I run that SQL through sqlplus, it does seem to be valid, and the tables/sequences are dropped.

I feel like I must be missing something very simple, but I'm executing that ruby statement under the same user/pass as the sqlplus, and getting different results.

I've tried this with both 1.8.7p299 and 1.9.1p378 using ActiveRecord 3.0.0beta4 and activerecord-oracle_enhanced-adapter version 1.3.0

Thoughts?

@rsim
Copy link
Owner

rsim commented Jul 7, 2010

Currently I have not yet implemented rake db:drop and db:create tasks.

If you need to empty test schema then you can use "rake db:test:purge".
If you need to empty other environment schema then you can take a look at http://github.com/rsim/oracle-enhanced/blob/master/lib/active_record/connection_adapters/oracle_enhanced.rake#L43-51 and implement similar task which would establish connection to specified environment (and not hardcoded test environment).

@svesely
Copy link
Author

svesely commented Jul 7, 2010

I forked and added the rake task, as well as an option to specify a default sequence suffix (I'm working with someone who's VERY particular about sql naming). Neither of these are covered with tests yet, as I'm not the DBA here so it's non-trivial to get a testing schema, but as soon as I get them covered I'll send you a pull request if you're interested.

Thank you for providing such an excellent plugin- this really does carry a large portion of the "making Rails enterprise-friendly" burden.

--Scott

This issue was closed.
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