I have an existing Rails 7 site, and turns out I won't use active record or a database of any kind in it. How can I remove everything related to databases to lighten the site? Should I even bother doing it?
CodePudding user response:
I agree with @Eyeslandic, you can just ignore it, but if you really want, to delete it, the steps to do so are:
Remove a gem that is responsible for database handling (mysql2, psql, whatever you have in Gemfile)
Change your config/application.rb. If you have
require rails/all
you will need to remove it, and require only the parts you do need. If you want to see what those are exactly, create a new rails app where in setup you skip active record, and copy the require statements from there. The full list of what rails/all require is here I think Remove all config lines that go something likeconfig.active_record
.... you find in the appDelete your config/database.yml file, db/schema.rb and migrations
Adjust your test setup, remove database cleaners etc, this will depend on what test framework you have in the app (if any). Take fixtures into account if you have any
search
config/environments/*
for any mentons of active_record and database config