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

Introduce a :nulldb_postgres adapter for providing postgres features. #42

Closed
wants to merge 4 commits into from

Conversation

Empact
Copy link

@Empact Empact commented Aug 16, 2013

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.

… 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.
…properly detect postgres, but I can at least allow the caller to declare it on the way in.
@erkki
Copy link

erkki commented Jan 18, 2014

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

@kshmir
Copy link

kshmir commented May 5, 2014

You should also consider or try what happens with postgis, I'm using spatial columns and they fail when used with nulldb.

 Failure/Error: subject.should respond_to(:memberships)
 NoMethodError:
 undefined method `spatial' for #<ActiveRecord::ConnectionAdapters::TableDefinition:0x0000000b1a1c28>

@mckinnsb
Copy link

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
Copy link
Member

mnoack commented Nov 23, 2016

@Empact @mckinnsb @erkki @kshmir I have just been added as a maintainer to nulldb. If this PR can be rebased off master, passed the tests I'll gladly look into it.

@atodorov
Copy link

atodorov commented Dec 8, 2016

@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.

@mnoack
Copy link
Member

mnoack commented Dec 8, 2016

@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.

@mnoack
Copy link
Member

mnoack commented Dec 28, 2016

@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.

@mnoack mnoack closed this Dec 28, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants