בעיה בשחזור: הפונקציה "mirror_topic_timers_topic_id" כבר קיימת עם אותם סוגי ארגומנטים

סיכום מבוסס בינה מלאכותית

pfaffman encountered an error while restoring a production database to a development site, specifically a PG::DuplicateFunction error related to the function mirror_topic_timers_topic_id. The issue appears to be linked to a recent change in the Discourse codebase, as mentioned in a GitHub pull request. Other users, such as thoka and kulimeya, reported the same problem. tgxworld investigated and provided a fix, which was quickly merged into the codebase as noted by pfaffman. The solution involved reverting to a previous commit, deleting the existing database, and rebuilding it before attempting the restore.

I’m trying to restore a production database from 04dbc622ab1e0197d16703ba47cf005ec93697ee to a development site f608e0cd7e7d4785b3ecb401999cfb837cfbe783

I’m getting these errors:

Failed to migrate database.                                                                                                                           [90/9045]
Ignoring db/schema_cache.yml because it has expired. The current schema version is 20250724012518, but the one in the schema cache file is 20250916082012.
rake aborted!
StandardError: An error has occurred, this and all later migrations canceled: (StandardError)

PG::DuplicateFunction: ERROR:  function "mirror_topic_timers_topic_id" already exists with same argument types
/home/pfaffman/src/discourse-repos/discourse/lib/migration/safe_migrate.rb:107:in `async_exec'
/home/pfaffman/src/discourse-repos/discourse/db/migrate/20250902014817_add_timerable_id_to_topic_timer.rb:15:in `up'
/home/pfaffman/src/discourse-repos/discourse/lib/freedom_patches/schema_migration_details.rb:8:in `block in exec_migration'
/home/pfaffman/src/discourse-repos/discourse/lib/freedom_patches/schema_migration_details.rb:8:in `exec_migration'
/home/pfaffman/src/discourse-repos/discourse/lib/migration/safe_migrate.rb:28:in `migrate'
/home/pfaffman/src/discourse-repos/discourse/lib/migration/safe_migrate.rb:53:in `migrate'
/home/pfaffman/src/discourse-repos/discourse/lib/tasks/db.rake:267:in `block (2 levels) in <main>'
/home/pfaffman/src/discourse-repos/discourse/lib/distributed_mutex.rb:53:in `block in synchronize'
/home/pfaffman/src/discourse-repos/discourse/lib/distributed_mutex.rb:49:in `synchronize'
/home/pfaffman/src/discourse-repos/discourse/lib/distributed_mutex.rb:49:in `synchronize'
/home/pfaffman/src/discourse-repos/discourse/lib/distributed_mutex.rb:34:in `synchronize'
/home/pfaffman/src/discourse-repos/discourse/lib/tasks/db.rake:242:in `block in <main>'

Caused by:
ActiveRecord::StatementInvalid: PG::DuplicateFunction: ERROR:  function "mirror_topic_timers_topic_id" already exists with same argument types (ActiveRecord::S
tatementInvalid)
/home/pfaffman/src/discourse-repos/discourse/lib/migration/safe_migrate.rb:107:in `async_exec'
/home/pfaffman/src/discourse-repos/discourse/db/migrate/20250902014817_add_timerable_id_to_topic_timer.rb:15:in `up'
/home/pfaffman/src/discourse-repos/discourse/lib/freedom_patches/schema_migration_details.rb:8:in `block in exec_migration'
/home/pfaffman/src/discourse-repos/discourse/lib/freedom_patches/schema_migration_details.rb:8:in `exec_migration'
/home/pfaffman/src/discourse-repos/discourse/lib/migration/safe_migrate.rb:28:in `migrate'
/home/pfaffman/src/discourse-repos/discourse/lib/migration/safe_migrate.rb:53:in `migrate'
/home/pfaffman/src/discourse-repos/discourse/lib/tasks/db.rake:267:in `block (2 levels) in <main>'
/home/pfaffman/src/discourse-repos/discourse/lib/distributed_mutex.rb:53:in `block in synchronize'
/home/pfaffman/src/discourse-repos/discourse/lib/distributed_mutex.rb:49:in `synchronize'
/home/pfaffman/src/discourse-repos/discourse/lib/distributed_mutex.rb:49:in `synchronize'
/home/pfaffman/src/discourse-repos/discourse/lib/distributed_mutex.rb:34:in `synchronize'
/home/pfaffman/src/discourse-repos/discourse/lib/tasks/db.rake:242:in `block in <main>'

I think it might have to do with this:

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

לייק 1

יש לי את אותה הבעיה (1e42f55be0 עד 452e5064c9).

לייק 1

אני אבדוק את זה היום.

3 לייקים

מטורף, בדיוק סיימתי להכין הכל בגרסת הפיתוח שלי, ההתקנה הראשונה שלי של Discourse, בדיוק עמדתי לייבא אותה לגרסה החיה שהותקנה זה עתה והייתה לי בדיוק השגיאה הזו. והתוצאה היחידה בגוגל היא הפוסט הזה מלפני 5 שעות. מקווה שזה יתוקן כדי שאוכל להשיק.

לייק 1

אתה יכול להמציא השקה עם הקומיט שלפני זה המופיע כאן.

הצורך שלך למחוק את מסד הנתונים הקיים, לבנות מחדש עם הקומיט שלפני, וכנראה לעשות את השחזור.

וחמש שעות זה SEO די טוב.

I’ve opened a PR with a fix and am getting it reviewed ASAP.

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

5 לייקים

וזה אכן מוזג זמן קצר לאחר הפוסט הזה!

3 לייקים

נושא זה נסגר אוטומטית 7 ימים לאחר התגובה האחרונה. לא ניתן להוסיף תגובות חדשות.