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

Add support for SQLite #1248

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Add support for SQLite #1248

wants to merge 1 commit into from

Conversation

nickcharlton
Copy link
Member

With increasing interest in SQLite across the Rails community as a whole, it's valuable for us to start exploring it too. This expands the existing checks for PostgreSQL to also include SQLite so that where we want to try out SQLite we're able to. It also adjusts the CI workflow to exclude PostgreSQL when generating a SQLite-based application.

https://rubyonrails.org/2024/11/7/rails-8-no-paas-required
https://fractaledmind.github.io/tags/sqlite/

Closes #1245

With increasing interest in SQLite across the Rails community as a
whole, it's valuable for us to start exploring it too. This expands the
existing checks for PostgreSQL to also include SQLite so that where we
want to try out SQLite we're able to. It also adjusts the CI workflow to
exclude PostgreSQL when generating a SQLite-based application.

https://rubyonrails.org/2024/11/7/rails-8-no-paas-required
https://fractaledmind.github.io/tags/sqlite/

Closes #1245
@@ -31,7 +31,7 @@ This approach uses an [application template][] to generate a new Rails
application with Suspenders.

We skip the [default test framework][] in favor of [RSpec][], and [prefer
PostgreSQL][] as our database.
PostgreSQL][] as our database, although we do support SQLite.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm being a bit … careful (?) with my README changes here. I want to suggest it's possible, but we're just trying it out, and it's worth evaluating and not that you should necessarily switch away from Postgres.

That said, maybe we need an explicit example?

@purinkle
Copy link

We are trying to keep Suspenders as close to Rails defaults as possible, but I still expect us to have an opinion. Otherwise, we should run rails new and be done with it. Are we trying out SQLite? Should team members start new Rails apps with SQLite? Suspenders should reflect our practices, not our aspirations.

@MatheusRich
Copy link

MatheusRich commented Feb 12, 2025

Are we trying out SQLite? Should team members start new Rails apps with SQLite?

I think there are a number of (small?) projects that would benefit from a simpler setup. You just want to try out an idea or build a side project. That shouldn't require you to deploy 2 different servers


That being said, should we just run

rails db:system:change --to=sqlite3

Comment on lines +8 to +12
test "database_adapter returns the current database" do
with_database "postgresql" do
assert_equal database_adapter, "postgresql"
end
end
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this also cover the SQLite case?

@@ -21,7 +21,7 @@ class CiGeneratorTest < Rails::Generators::TestCase

test "raises if PostgreSQL is not the adapter" do
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Should this test description reflect "PostgreSQL or SQLite"?

  2. Should this or another test assert that with_database "sqlite" does not raise?

@@ -86,6 +86,7 @@ jobs:
runs-on: ubuntu-latest

services:
<%- if using_postgres? -%>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this block be tested that it is present for Postgres and absent for SQLite?

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

Successfully merging this pull request may close these issues.

We don't just prefer, but require the use of Postgres
4 participants