Can't restore database because migration in the database was in the (missing) discourse-ai plugin

AI-generated summary

The user, pfaffman, encountered an issue restoring a database due to a migration error related to the discourse-ai plugin, specifically involving an unknown OID for ‘embeddings’. The migration status showed that the relevant migration file existed, but the database couldn’t proceed. RGJ suggested the issue was likely tied to discourse-ai migrations, not core ones, and questioned whether the vector extension was enabled on the production database. pfaffman realized the missing plugin on the development system was the cause, as it was present in the backup source, and successfully resolved the issue.

I’m trying to migrate a database and am getting

unknown OID 446656: failed to recognize type of 'embeddings'. It will be treated as String.

rake db:migrate:status shows

...
   up     20240304030429  Topic id on incoming email index
   up     20240306063428  Add indexes to notifications
   up     20240307231053  Add topics unread when closed to user options

And I can see \./db/migrate/20240307231053_add_topics_unread_when_closed_to_user_options.rb in the path, so it seems that the above error is keeping the database from migrating, which is keeping me from restoring a database.

pgvector is installed and enabled on the developmetn and test databases, which was my only guess. . .

This probably is about migrations by discourse-ai, not core.

So not on production?

What does SELECT * FROM pg_extension WHERE extname = 'vector'; tell you?

Aha. I needed to add the AI plugin which is on the system that generated the backup but not on the development system.

It took me another minute, but that was the clue I needed.

Thanks so very much! :beer: