lib/rom/sql/gateway.rb in rom-sql-0.6.0 vs lib/rom/sql/gateway.rb in rom-sql-0.6.1
- old
+ new
@@ -65,10 +65,11 @@
repo_options = self.class.option_definitions.names
conn_options = options.reject { |k,_| repo_options.include?(k) }
@connection = connect(uri, conn_options)
@schema = connection.tables
+ add_extensions(Array(options[:extensions])) if options[:extensions]
super(uri, options.reject { |k,_| conn_options.keys.include?(k) })
end
# Disconnect from database
@@ -158,9 +159,16 @@
when ::Sequel::Database
uri
else
::Sequel.connect(uri.to_s, *args)
end
+ end
+
+ # Add extensions to the database connection
+ #
+ # @api private
+ def add_extensions(exts)
+ connection.extension(*exts)
end
end
end
end