How to use pgvector on postgres db?

I have build a small file_search feature on a rails app that I deploy on fly. Locally, it works flawlessly but while deploying I believe the fact I added the pgvector type on some model fields makes the db:migrate (rails command used on deployment) fails.

Is it any clean way to use pgvector on an existing postgres db and deploy my app?

Sincerely

paul

You need to install the Postgres extension:

rails generate migration enable_pgvector_extension

class EnablePgvectorExtension < ActiveRecord::Migration[8.0]
def change
enable_extension ‘vector’
end
end

As i said in my message, it works flawlessly in local, hence, you can assume i have already setup postgres with vectors. The issue here is that fly doesn’t support the vecors extentions by design so you need to roll your own pg image in production.

Anyway, i switched to pinecone…

thank for taking the time to reply but with all due respect, this answer is irrelevant

No worries - I forgot that I rolled my own Postgres image. Anywy, just trying to help. Good luck with pinecone.

1 Like

A couple years old, but fly staff said to roll your own image:

Pinecone is plug & play, took me literally 10 minutes to make it work in production.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.