You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For more information, see the extension's [source code](https://sqlite.org/src/file/ext/misc/uuid.c?t=version-3.46.1).
30
+
For more information about the extension itself, see the extension's [source code](https://sqlite.org/src/file/ext/misc/uuid.c?t=version-3.46.1).
35
31
36
-
## Design
32
+
## How it works
37
33
38
34
This gem compiles SQLite's uuid extension into a shared library using Ruby's native-gem functionality.
39
35
40
-
It doesn't actually compile a Ruby native extension, it just uses the ruby extension process to compile the SQLite library.
41
-
42
-
It then exposes a method (`SqliteExtensions::UUID.to_path`) which returns the location of that shared library, which can be passed to [sqlite3](https://github.com/sparklemotion/sqlite3-ruby)'s `load_extension` method.
43
-
44
-
For Rails, it also exposes a [railtie](https://api.rubyonrails.org/v7.2/classes/Rails/Railtie.html) (via `require: "sqlite_extensions/uuid/rails"`) that patches Rails' [configure_connection](https://github.com/rails/rails/blob/v8.0.0.rc1/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb#L815) method for the SQLite adapter, so that all SQLite database connections load the extension.
36
+
It doesn't _actually_ compile a Ruby native extension, it just uses the ruby extension process to compile the SQLite UUID library.
45
37
46
-
This doesn't scale well to supporting multiple SQLite extensions, but works fine if all you need is the UUID extension.
38
+
It then exposes a method, `SqliteExtensions::UUID.to_path`, which returns the location of that shared library.
47
39
48
-
Ideally, Rails will eventually provide an official way to configure the SQLite connection, at which point we can migrate the railtie to that approach.
40
+
This can be passed to [sqlite3](https://github.com/sparklemotion/sqlite3-ruby) in `Database.new(extensions: [])` or `Database#load_extension`.
0 commit comments