Dev migratiefout: Discourse AI

AI-generated summary

A developer encountered a migration error in Discourse AI, specifically a PG::UndefinedTable error related to ai_topic_embeddings_1_1 during a database migration. merefield reported the issue, noting that deleting the plugin allowed the migration to proceed. jahan_gagan referenced a related meta discussion, which merefield confirmed as helpful but noted the user was later deleted. merefield acknowledged the issue required manual intervention. pmusaraj suggested a potential fix via a GitHub pull request, which merefield tested and confirmed resolved the issue, crediting pmusaraj and Falco. pmusaraj acknowledged Falco as the primary contributor.

PG::UndefinedTable: ERROR:  relation "ai_topic_embeddings_1_1" does not exist
LINE 3:       FROM ai_topic_embeddings_1_1;
                   ^
/home/robert/discourse/plugins/discourse-ai/db/migrate/20240611170905_move_embeddings_to_single_table_per_type.rb:51:in `up'
/home/robert/discourse/lib/freedom_patches/schema_migration_details.rb:8:in `block in exec_migration'
/home/robert/discourse/lib/freedom_patches/schema_migration_details.rb:8:in `exec_migration'
/home/robert/discourse/lib/migration/safe_migrate.rb:28:in `migrate'
/home/robert/discourse/lib/migration/safe_migrate.rb:53:in `migrate'
/home/robert/discourse/lib/tasks/db.rake:267:in `block (2 levels) in <main>'
/home/robert/discourse/lib/distributed_mutex.rb:53:in `block in synchronize'
/home/robert/discourse/lib/distributed_mutex.rb:49:in `synchronize'
/home/robert/discourse/lib/distributed_mutex.rb:49:in `synchronize'
/home/robert/discourse/lib/distributed_mutex.rb:34:in `synchronize'
/home/robert/discourse/lib/tasks/db.rake:242:in `block in <main>'
/home/robert/.rbenv/versions/3.3.2/bin/bundle:25:in `load'
/home/robert/.rbenv/versions/3.3.2/bin/bundle:25:in `<main>'

Caused by:
ActiveRecord::StatementInvalid: PG::UndefinedTable: ERROR:  relation "ai_topic_embeddings_1_1" does not exist (ActiveRecord::StatementInvalid)
LINE 3:       FROM ai_topic_embeddings_1_1;
                   ^
/home/robert/discourse/plugins/discourse-ai/db/migrate/20240611170905_move_embeddings_to_single_table_per_type.rb:51:in `up'
/home/robert/discourse/lib/freedom_patches/schema_migration_details.rb:8:in `block in exec_migration'
/home/robert/discourse/lib/freedom_patches/schema_migration_details.rb:8:in `exec_migration'
/home/robert/discourse/lib/migration/safe_migrate.rb:28:in `migrate'
/home/robert/discourse/lib/migration/safe_migrate.rb:53:in `migrate'
/home/robert/discourse/lib/tasks/db.rake:267:in `block (2 levels) in <main>'
/home/robert/discourse/lib/distributed_mutex.rb:53:in `block in synchronize'
/home/robert/discourse/lib/distributed_mutex.rb:49:in `synchronize'
/home/robert/discourse/lib/distributed_mutex.rb:49:in `synchronize'
/home/robert/discourse/lib/distributed_mutex.rb:34:in `synchronize'
/home/robert/discourse/lib/tasks/db.rake:242:in `block in <main>'
/home/robert/.rbenv/versions/3.3.2/bin/bundle:25:in `load'
/home/robert/.rbenv/versions/3.3.2/bin/bundle:25:in `<main>'

Caused by:
PG::UndefinedTable: ERROR:  relation "ai_topic_embeddings_1_1" does not exist (PG::UndefinedTable)
LINE 3:       FROM ai_topic_embeddings_1_1;

Heeft iemand dit opgelost?

(Draait PG 16.3)

Voor nu heb ik de plugin verwijderd en de rest van de migratie verloopt soepel.

Checkout this

dat is precies wat @Crypto_and_Co zojuist heeft gepost, geen idee waarom het werd gemarkeerd??

(oh ze zijn nu een verwijderde gebruiker, heel vreemd, het was een nuttige post!)

erg erg rommelig, maar ja, vereist mogelijk handmatig werk …

Does this commit address the issue @merefield?

https://github.com/discourse/discourse/pull/33943

ooh bedankt, ik zal het controleren en erop terugkomen.

bedankt dat je hiernaar hebt gekeken!

dat werkte prima, bedankt @pmusaraj @Falco

Geweldig, alle credits gaan naar Falco.