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

We don't just prefer, but require the use of Postgres #1245

Open
nickcharlton opened this issue Dec 20, 2024 · 3 comments
Open

We don't just prefer, but require the use of Postgres #1245

nickcharlton opened this issue Dec 20, 2024 · 3 comments

Comments

@nickcharlton
Copy link
Member

I've been working on updating a little script I have for testing out Administrate, where I'll go about creating a bunch of small Rails applications for testing. This has one problem of leaving a lot of unused, potentially clashing Postgres databases sitting around.

To work around this problem, I considered using SQLite — especially as there's been significant renewed interest in it up to and including Rails 8.0.

Whilst we prefer Postgres (and I don't see a need to generally diverge from this opinion), the way we've implemented lib/install/web.rb stops us from using another database type, for example:

$ rails new app_name \
 --suspenders-local \
 --skip-rubocop \
 --skip-test \
 -d=postgresql \
 -m=~/projects/thoughtbot/suspenders/lib/install/web.rb

[… snip …]

remove  config/initializers/cors.rb
      remove  config/initializers/new_framework_defaults_8_0.rb
       apply  /Users/nickcharlton/projects/thoughtbot/suspenders/lib/install/web.rb
  in the local project!
The template [/Users/nickcharlton/projects/thoughtbot/suspenders/lib/install/web.rb] could not be loaded. Error:

=== Please use the correct options ===

# Use the latest suspenders release:
rails new <app_name> \
--skip-rubocop \
--skip-test \
-d=postgresql \
-m=https://raw.githubusercontent.com/thoughtbot/suspenders/main/lib/install/web.rb

# OR use the current (possibly unreleased) `main` branch of suspenders:
rails new <app_name> \
--suspenders-main \
--skip-rubocop \
--skip-test \
-d=postgresql \
-m=https://raw.githubusercontent.com/thoughtbot/suspenders/main/lib/install/web.rb

The implementation of lib/install/web.rb looks like this:

if options[:database] == "postgresql" && options[:skip_test] && options[:skip_rubocop]
after_bundle do
gem_group :development, :test do
if ARGV.include?("--suspenders-main")
gem "suspenders", github: "thoughtbot/suspenders", branch: "main"
else
gem "suspenders"
end
end

Can anyone think of a better way to do that test in options[:database], etc? The intention is to see if we should setup and run our suspenders generator, but it's doing more than that.

@stevepolitodesign
Copy link
Contributor

@nickcharlton thank you for bringing this up. We're currently working on an internal project to help us re-evaluate our assumptions when it comes to building new Rails 8 applications, and choosing a database is one of the issues I'm most interested in.

@nickcharlton
Copy link
Member Author

Yeah, I think it's going to be interesting to see what we might like to change.

I think in this particular situation, we can be less strict about what we allow to use suspenders, but still push towards Postgres. What do you think?

@stevepolitodesign
Copy link
Contributor

I think in this particular situation, we can be less strict about what we allow to use suspenders, but still push towards Postgres.

I agree.

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