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

Adopt sqlite extension loading #325

Merged
merged 4 commits into from
Dec 18, 2024
Merged

Adopt sqlite extension loading #325

merged 4 commits into from
Dec 18, 2024

Conversation

rossta
Copy link
Contributor

@rossta rossta commented Dec 18, 2024

The sqlite3-ruby gem recently published an improvement to make it easier and more flexible to load extensions:

sparklemotion/sqlite3-ruby#586

Ruby modules for SQLite extensions should implement the interface:

interface _ExtensionSpecifier
  def to_path: () → String
end

A complementary change in Rails takes advantage of this interface to integrate the primary configuration file with the new sqlite3-ruby interface for extension loading:

rails/rails#53827

The gem template provided here already has a similar method:

def loadable_path

This PR updates sqlite3-ruby and database.yml to take advantage of the new feature. Joy of Rails currently uses two extensions: sqlite-ulid and sqlite-vec. Since these gems do no currently implement the expected interface, I’ve added adapter classes to lib/.

Side note: I have also opened a PR on a repo that would presumably add the feature to the sqlite-vec gem and other extensions by the same author: asg017/sqlite-dist#11

@rossta rossta force-pushed the feat/sqlite-extension-loading branch from 1e0821f to 2e347b1 Compare December 18, 2024 22:34
Lib files are necessary to adapt to the to_path interface expected by
the extension loading mechansim

Make Zeitwerk happy when eager loading enabled
@rossta rossta force-pushed the feat/sqlite-extension-loading branch from 2e347b1 to db183ca Compare December 18, 2024 22:51
@rossta rossta merged commit 20914f3 into main Dec 18, 2024
9 checks passed
@rossta rossta deleted the feat/sqlite-extension-loading branch December 18, 2024 22:56
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.

1 participant