# Dev migration error: Discourse AI

**URL:** https://meta.discourse.org/t/dev-migration-error-discourse-ai/376173
**Category:** Development
**Tags:** ai
**Created:** [July 28, 2025, 12:44pm UTC](https://meta.discourse.org/t/dev-migration-error-discourse-ai/376173 "2025-07-28T12:44:52Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![merefield](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/merefield/32/176214_2.png) [@merefield](https://meta.discourse.org/u/merefield)
#### Post date: [July 28, 2025, 12:44pm UTC](https://meta.discourse.org/t/dev-migration-error-discourse-ai/376173/1 "2025-07-28T12:44:52Z")

</div>

```plaintext
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;

```

Anyone resolved this?

(Running PG 16.3)

For now I’ve deleted the plugin, and the rest of the migration go through.

---

<div class="post-metadata">

### Author: ![jahan\_gagan](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jahan_gagan/32/501948_2.png) [@jahan\_gagan](https://meta.discourse.org/u/jahan_gagan)
#### Post date: [July 28, 2025, 1:00pm UTC](https://meta.discourse.org/t/dev-migration-error-discourse-ai/376173/3 "2025-07-28T13:00:11Z")

</div>

Checkout this

> [@Applied migrations we shouldn't have with discourse-ai](https://meta.discourse.org/t/applied-migrations-we-shouldnt-have-with-discourse-ai/326824/2):
>
> Just saw there’s a migration called 20240611170905\_move\_embeddings\_to\_single\_table\_per\_type which indicate that we applied migrations we shouldn’t have by using the wrong plugin version. I have multiple migrations like this, which refer to the one that shouldn’t be done i think : up 20240807150605 \*\*\*\*\*\*\*\*\*\* NO FILE \*\*\*\*\*\*\*\*\*\* up 20240809162837 \*\*\*\*\*\*\*\*\*\* NO FILE \*\*\*\*\*\*\*\*\*\* up 20240809163303 \*\*\*\*\*\*\*\*\*\* NO FILE \*\*\*\*\*\*\*\*\*\* Is there a way to rollback them ? If there’s a way to …

---

<div class="post-metadata">

### Author: ![merefield](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/merefield/32/176214_2.png) [@merefield](https://meta.discourse.org/u/merefield)
#### Post date: [July 28, 2025, 1:03pm UTC](https://meta.discourse.org/t/dev-migration-error-discourse-ai/376173/4 "2025-07-28T13:03:56Z")

</div>

that’s exactly what @Crypto_and_Co just posted, no idea why it was flagged??

(oh they are now a deleted user, very strange, it was a helpful post!)

---

<div class="post-metadata">

### Author: ![merefield](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/merefield/32/176214_2.png) [@merefield](https://meta.discourse.org/u/merefield)
#### Post date: [July 28, 2025, 1:08pm UTC](https://meta.discourse.org/t/dev-migration-error-discourse-ai/376173/5 "2025-07-28T13:08:13Z")

</div>

very messy but yeah, may require a manual effort …

---

<div class="post-metadata">

### Author: ![pmusaraj](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pmusaraj/32/119489_2.png) [@pmusaraj](https://meta.discourse.org/u/pmusaraj)
#### Post date: [July 30, 2025, 1:04pm UTC](https://meta.discourse.org/t/dev-migration-error-discourse-ai/376173/6 "2025-07-30T13:04:38Z")

</div>

Does this commit address the issue @merefield?

[https://github.com/discourse/discourse/pull/33943](https://github.com/discourse/discourse/pull/33943)

---

<div class="post-metadata">

### Author: ![merefield](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/merefield/32/176214_2.png) [@merefield](https://meta.discourse.org/u/merefield)
#### Post date: [July 30, 2025, 1:16pm UTC](https://meta.discourse.org/t/dev-migration-error-discourse-ai/376173/7 "2025-07-30T13:16:57Z")

</div>

ooh thanks, I’ll check and revert.

appreciate you looking at this!

---

<div class="post-metadata">

### Author: ![merefield](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/merefield/32/176214_2.png) [@merefield](https://meta.discourse.org/u/merefield)
#### Post date: [July 30, 2025, 1:22pm UTC](https://meta.discourse.org/t/dev-migration-error-discourse-ai/376173/8 "2025-07-30T13:22:35Z")

</div>

that worked just great, thanks a bunch @pmusaraj @Falco

---

<div class="post-metadata">

### Author: ![pmusaraj](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pmusaraj/32/119489_2.png) [@pmusaraj](https://meta.discourse.org/u/pmusaraj)
#### Post date: [July 30, 2025, 5:06pm UTC](https://meta.discourse.org/t/dev-migration-error-discourse-ai/376173/9 "2025-07-30T17:06:05Z")

</div>

Awesome, all props should go to Falco.

---

<div class="post-metadata">

### Author: ![pmusaraj](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pmusaraj/32/119489_2.png) [@pmusaraj](https://meta.discourse.org/u/pmusaraj)
#### Post date: [July 31, 2025, 12:00pm UTC](https://meta.discourse.org/t/dev-migration-error-discourse-ai/376173/10 "2025-07-31T12:00:36Z")

</div>

This topic was automatically closed after 18 hours. New replies are no longer allowed.
