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
Introduce a :nulldb_postgres adapter for providing postgres features. #42
Conversation
… special postgres db features of rails 4, including column types and enable_extension. This adapter is automatically used by NullDB::RSpec::NullifiedDatabase if it detects a test db configured for postgresql.
…ly calling #checkpoint! if it's available.
…properly detect postgres, but I can at least allow the caller to declare it on the way in.
I've solved this locally atm just by including postgres column methods in spec_helper.rb ActiveRecord::ConnectionAdapters::NullDBAdapter::TableDefinition.send :include, ActiveRecord::ConnectionAdapters::PostgreSQLAdapter::ColumnMethods |
You should also consider or try what happens with postgis, I'm using spatial columns and they fail when used with nulldb.
|
I am also experiencing conflicts with PostGIS, and I would also like to run some tests on models with spatial columns without hitting Postgres. |
@mnoack I think I'll also need this PR merged b/c I have PostreSQL and JSON fields and trying to get NullDB working. I will be poking around the code in the next following days to get myself familiar. If the OP doesn't respond I will try to rebase this PR and see how it goes. |
@atodorov If someone can rebase this PR (or make their own) off master of nulldb, and it passes the tests I'm more than happy to review and hopefully merge. Even if you rebase and PR so we can at least see what tests are failing (e.g. I suspect rails 5 will fail in this PR - but this PR was done at a time when rails5 wasn't supported or tested against) and I can assist if needed. |
@atodorov I'm closing this because I haven't heard back, but I definitely welcome postgres support. The key thing I would be looking for in any future PR is the test side to ensure automated tests can cover this change. |
This is not quite ready for merge, but I want to put it up for discussion. Currently nulldb blows up if you use any of the fancy new postgres features that Rails 4 rolls out. I set about getting them working an this is my approach: creating a minimal second adapter which extends the first, and adding some extension points to enable them to operate against one another.
The main concern I have at this point is not knowing how to reliable identify the original adapter type of the database, before it was nullified. I have it working in nulldb_rspec, but not in nulldb/core.
Any thoughts/advice would be appreciated.