-
Notifications
You must be signed in to change notification settings - Fork 304
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
PostgreSQL support broken since January 10, 2018 (release of pg 1.0.0) #368
Comments
Yes, thanks for bringing it to my attention. I'll address it as soon. |
@yemartin can you improve on my conditional logic, please?
|
Fixed in rails_apps_composer version 3.1.31. |
@yemartin I've released the new rails_apps_composer version 3.1.31 and updated Rails Composer. Could you please test and reopen this issue if it's not resolved. |
@DanielKehoe Thank you for the great response time! I see you already released the fix, but in case you are still interested in improving the conditional logic, how about using # We may want to extract this somewhere to the top to make it reusable:
RAILS_VERSION = Gem::Version.new(Rails::VERSION::STRING)
if prefer :database, 'postgresql'
if RAILS_VERSION < Gem::Version.new("5.1.5")
add_gem 'pg', '~> 0.18'
else
add_gem 'pg'
end
end Now if we want to take into account that the fix was also backported to both Rails 5.0.7 and 5.1.5, it is a bit more complex, but still not too bad: # We may want to extract this somewhere to the top to make it reusable:
RAILS_VERSION = Gem::Version.new(Rails::VERSION::STRING)
if prefer :database, 'postgresql'
if RAILS_VERSION < Gem::Version.new("5.0.7") || \
(RAILS_VERSION >= Gem::Version.new("5.1") && RAILS_VERSION < Gem::Version.new("5.1.5"))
add_gem 'pg', '~> 0.18'
else
add_gem 'pg'
end
end I tested it locally and it seems to work. But now, I see the rest of the code does not use |
The release of version 1.0.0 of the
pg
gem on January 10, 2018 has broken PostgreSQL support. Steps to reproduce: create a new Custom application with PostgreSQL support. It shows the following error:This is a knows issue that will be addressed in Rails 5.1.5, but even when fixed in Rails, it will leave rails_apps_composer with broken PostgreSQL support for any earlier Rails version...
As specified on the Rails pull request that fixes the issue, Rails versions prior to
5.1.5
(and to5.0.?
? must use:So maybe rails_apps_composer should look at the Rails version, and create the
pg
Gemfile line accordingly?The text was updated successfully, but these errors were encountered: