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

What would it take to use under SQLite3? #47

Open
francois opened this issue Mar 25, 2024 · 3 comments · May be fixed by #51
Open

What would it take to use under SQLite3? #47

francois opened this issue Mar 25, 2024 · 3 comments · May be fixed by #51

Comments

@francois
Copy link

francois commented Mar 25, 2024

I'd be interested in running this gem with SQLite3 instead of PG. Backing up the database in a single file would be so very interesting!

I tried setting up Appraisal (and removing MySQL and MSSQL as I don't have that installed), but when I ran, I got the following:

$ bundle exec appraisal rails-7_1-sqlite3 rspec
>> BUNDLE_GEMFILE=/Users/francois/Projects/scoutges/active_storage_db/gemfiles/rails_7_1_sqlite3.gemfile bundle exec rspec

An error occurred while loading rails_helper.
Failure/Error: require File.expand_path("dummy#{app_ver}/config/environment.rb", __dir__)

LoadError:
  cannot load such file -- /Users/francois/Projects/scoutges/active_storage_db/spec/dummy/config/environment.rb
# ./spec/rails_helper.rb:37:in `<top (required)>'
No examples found.

Finished in 0.00003 seconds (files took 0.21598 seconds to load)
0 examples, 0 failures, 1 error occurred outside of examples

I suspect the environment isn't correctly setup.

I would be interested in making this gem work. What would it take?

@blocknotes
Copy link
Owner

Hey @francois

The error that you receive is probably related to the environment variables needed to setup the test config.
For example for Postgres and Rails 7.x I use:

DB_TEST=postgres RAILS=7.0 be appraisal rails-7_1-postgres rspec

Honestly I should evaluate carefully what it would be required to make the gem work with SQLite, but it seems a very specific use case to me because ActiveStorage can store the attachments on the filesystem on its own...

@francois
Copy link
Author

@blocknotes, I'm interested in storing data to a SQLite because then I will have a single file backup, and all data will be consistent with each other. Thanks for the pointer. I'll try that.

@blocknotes blocknotes linked a pull request Sep 8, 2024 that will close this issue
@blocknotes
Copy link
Owner

Hey @francois

I prepared an experimental PR to add SQLite support: #51

The branch is: feat/sqlite-support

If you have a chance to make some tests, please share the results.

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 a pull request may close this issue.

2 participants