Move extension configuration to config file

Kudos to Mike for the tip
This commit is contained in:
Jorge Manrubia
2025-05-16 16:17:54 +02:00
parent e0e17d2bd0
commit 40b78e4115
3 changed files with 4 additions and 14 deletions
+1
View File
@@ -1,6 +1,7 @@
require_relative "boot"
require "rails/all"
require "sqlite_vec" # Referenced in database.yml
# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
+3
View File
@@ -8,6 +8,8 @@ default: &default
adapter: sqlite3
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
timeout: 5000
extensions:
- <%= SqliteVec.loadable_path %>
development:
primary:
@@ -42,6 +44,7 @@ production:
tenanted: true
extensions:
- ./bin/lib/beamer.so
- <%= SqliteVec.loadable_path %>
primary_original:
<<: *default
database: storage/production.sqlite3
-14
View File
@@ -1,14 +0,0 @@
require "sqlite_vec"
require "active_record/connection_adapters/sqlite3_adapter"
module SqliteVecExtension
def configure_connection
super
db = @raw_connection
db.enable_load_extension(true)
SqliteVec.load(db)
db.enable_load_extension(false)
end
end
ActiveRecord::ConnectionAdapters::SQLite3Adapter.prepend(SqliteVecExtension)