Move extension configuration to config file
Kudos to Mike for the tip
This commit is contained in:
@@ -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.
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
Reference in New Issue
Block a user