PG::UndefinedTable: ERROR: relation "translation_overrides" does not exist

I have cloned master and in trying to run migrations i get this error:

ActiveRecord::StatementInvalid: PG::UndefinedTable: ERROR: relation “translation_overrides” does not exist

I see that a topic was created for this last November and seemingly fixed so i’m wondering what coudl be the cause?

ActiveRecord::StatementInvalid: PG::UndefinedTable: ERROR:  relation "translation_overrides" does not exist
remote:        LINE 5:                WHERE a.attrelid = '"translation_overrides"':...
remote:        ^
remote:        :               SELECT a.attname, format_type(a.atttypid, a.atttypmod),
remote:        pg_get_expr(d.adbin, d.adrelid), a.attnotnull, a.atttypid, a.atttypmod
remote:        FROM pg_attribute a LEFT JOIN pg_attrdef d
remote:        ON a.attrelid = d.adrelid AND a.attnum = d.adnum
remote:        WHERE a.attrelid = '"translation_overrides"'::regclass
remote:        AND a.attnum > 0 AND NOT a.attisdropped
remote:        ORDER BY a.attnum


PG::UndefinedTable: ERROR:  relation "translation_overrides" does not exist
remote:        LINE 5:                WHERE a.attrelid = '"translation_overrides"':...

thanks

Is that a dev setup? If so, then run “rake db:drop db:create db:migrate” again.

production but getting it to run on heroku (i realise that heroku is not the ‘supported’, ‘recommended’ setup :slight_smile: ). despite that, do you have any ideas? thanks a lot

مرحباً بالجميع، يبدو أن هذه هي نفس المشكلة الموجودة في https://meta.discourse.org/t/migration-error-on-fresh-startup-running-in-k8s-cluster/184751، وتمكنا من إعادة إنتاجها في إعدادة مشغل Discourse قياسية باستخدام قالب standalone.yml الرسمي عند نشره:

$ ./launcher rebuild app
...
I, [2021-05-27T10:53:27.612150 #1]  INFO -- : > cd /var/www/discourse && su discourse -c 'bundle exec rake plugin:pull_compatible_all'
I, [2021-05-27T10:53:30.072954 #1]  INFO -- : docker_manager is already at latest compatible version

I, [2021-05-27T10:53:30.073194 #1]  INFO -- : > cd /var/www/discourse && su discourse -c 'bundle exec rake db:migrate'

2021-05-27 10:53:32.977 UTC [4354] discourse@discourse ERROR:  relation "translation_overrides" does not exist at character 454
2021-05-27 10:53:32.977 UTC [4354] discourse@discourse STATEMENT:  SELECT a.attname, format_type(a.atttypid, a.atttypmod),
	       pg_get_expr(d.adbin, d.adrelid), a.attnotnull, a.atttypid, a.atttypmod,
	       c.collname, col_description(a.attrelid, a.attnum) AS comment
	  FROM pg_attribute a
	  LEFT JOIN pg_attrdef d ON a.attrelid = d.adrelid AND a.attnum = d.adnum
	  LEFT JOIN pg_type t ON a.atttypid = t.oid
	  LEFT JOIN pg_collation c ON a.attcollation = c.oid AND a.attcollation <> t.typcollation
	 WHERE a.attrelid = '"translation_overrides"'::regclass
	   AND a.attnum > 0 AND NOT a.attisdropped
	 ORDER BY a.attnum

Warning: no type cast defined for type "name" with oid 19. Please cast this type explicitly to TEXT to be safe for future changes.
> Seeding theme and color schemes
I, [2021-05-27T10:53:49.976589 #1]  INFO -- : == 20000225050318 AddSchemaMigrationDetails: migrating ========================
...

يحدث هذا أيضًا في تثبيت رسمي بسيط لـ discourse_docker، باستخدام اختبار استعادة آلي عبر خط الأنابيب كل صباح من أيام الأسبوع. ظهر خطأ مشابه فجأة في خط الأنابيب الفاشل.

I, [2026-05-20T07:59:01.413128 #1]  INFO -- : > cd /var/www/discourse && su discourse -c 'bundle  
  exec rake db:migrate'                                                                                                                                                                       
  2026-05-20 07:59:09.214 UTC [1576] discourse@discourse ERROR:  relation "translation_overrides" does not exist at character 523                                                             
  2026-05-20 07:59:09.214 UTC [1576] discourse@discourse STATEMENT:  SELECT a.attname, format_type(a.atttypid, a.atttypmod),                                                                  
             pg_get_expr(d.adbin, d.adrelid), a.attnotnull, a.atttypid, a.atttypmod,                                                                                                          
             c.collname, col_description(a.attrelid, a.attnum) AS comment,                                                                                                                    
             attidentity AS identity,                                                                                                                                                         
             attgenerated as attgenerated                                                                                                                                                     
        FROM pg_attribute a                                                                                                                                                                   
        LEFT JOIN pg_attrdef d ON a.attrelid = d.adrelid AND a.attnum = d.adnum                                                                                                               
        LEFT JOIN pg_type t ON a.atttypid = t.oid                                                                                                                                             
        LEFT JOIN pg_collation c ON a.attcollation = c.oid AND a.attcollation <> t.typcollation                                                                                               
       WHERE a.attrelid = '"translation_overrides"'::regclass                                                                                                                                 
         AND a.attnum > 0 AND NOT a.attisdropped                                                                                                                                              
       ORDER BY a.attnum                                                                                                                                                                      
                                                                                                                                                                                              
  2026-05-20 07:59:13.167 UTC [1627] discourse@discourse ERROR:  schema "discourse_functions" already exists                                                                                  
  2026-05-20 07:59:13.167 UTC [1627] discourse@discourse STATEMENT:  CREATE SCHEMA discourse_functions;                                                                                       
  psql:/var/www/discourse/db/structure.sql:16: ERROR:  schema "discourse_functions" already exists                                                                                            
  rake aborted!

كان السبب الجذري عدم تطابق الإصدار بين النسخة الاحتياطية المستعادة وكود الحاوية.

يحتوي أحدث كود لـ Discourse على نموذج يشير إلى جدول translation_overrides، لكن قاعدة بيانات الإنتاج (من النسخة الاحتياطية) تعمل على إصدار أقدم حيث إما أن هذا الجدول غير موجود بعد أو له اسم مختلف.

ما نجح معي هو إعادة البناء أولاً (مما ينشئ المخطط من الصفر)، ثم استعادة النسخة الاحتياطية. تستخدم عملية الاستعادة آلية الاستعادة المدمجة في Discourse، والتي تقوم بحذف قاعدة البيانات وإعادة إنشائها بشكل صحيح.