Skip to content

Conversation

@flavorjones
Copy link
Member

@flavorjones flavorjones commented Oct 12, 2025

In #204 and #214 we discussed that "path" methods don't belong in DatabaseConfigurations::BaseConfig because the concept of a file path is SQLite-specific.

This PR moves path concerns out of BaseConfig and into the SQLite adapter.

There are a few other notable changes in here, too, though:

  • I've removed the adapter delegation layer, and instead the BaseConfig and TenantConfig classes will create the adapter on demand and memoize it, which should mean fewer objects are being allocated
  • Dropped the unnecessary db_config argument to acquire_ready_lock

As I noted in the comment in database_adapters/sqlite.rb, I'm not entirely satisfied with how we've extracted the SQLite-specific behavior, because some methods feel like they should be in a database-specific subclass of BaseConfig, and the rest feel like they should be in the Rails database connection adapter. So I think we should continue to refactor this as the opportunity arises!

cc @andrewmarkle

We want the non-adapter code to avoid references to file paths. This
is a small initial step.
because over time there has been some drift from "tenanted config" to
"root config" but it's now named "base config" so let's use that name
everywhere.
Instead, memoize the adapter in the db config.
adding some temporary duplication in the meantime
@flavorjones flavorjones merged commit a1fdb5d into main Oct 12, 2025
7 checks passed
@flavorjones flavorjones deleted the flavorjones/214-move-db-path-into-sqlite-adapter branch October 12, 2025 17:48
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.

2 participants