Skip to content

Commit

Permalink
Fixed CI
Browse files Browse the repository at this point in the history
  • Loading branch information
ankane committed Sep 1, 2024
1 parent 92b0fc3 commit f340feb
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion lib/neighbor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,11 @@ def initialize_type_map(m = type_map)
module MysqlRegisterTypes
def initialize_type_map(m)
super
m.register_type %r(vector)i do |sql_type|
register_vector_type(m)
end

def register_vector_type(m)
m.register_type %r(^vector)i do |sql_type|
limit = extract_limit(sql_type)
Type::MysqlVector.new(limit: limit)
end
Expand Down Expand Up @@ -83,6 +87,9 @@ def initialize_type_map(m)

# prevent unknown OID warning
ActiveRecord::ConnectionAdapters::AbstractMysqlAdapter.singleton_class.prepend(Neighbor::MysqlRegisterTypes)
if ActiveRecord::VERSION::STRING.to_f < 7.1
ActiveRecord::ConnectionAdapters::AbstractMysqlAdapter.register_vector_type(ActiveRecord::ConnectionAdapters::AbstractMysqlAdapter::TYPE_MAP)
end
end

require_relative "neighbor/railtie" if defined?(Rails::Railtie)

0 comments on commit f340feb

Please sign in to comment.