nevscope is encountering a database error after migrating Discourse to a new server — specifically, a PG::SyntaxError involving a zero-length identifier in the site_settings table when trying to manually promote a user to admin via rails c. The issue persists even after rebuilding the app container and appears to also affect the original server, suggesting the problem may stem from the backup or a corrupted install. justin advises verifying app.yml settings, rebuilding the container, and considering a fresh backup from the old instance. nevscope considers manually clearing the site_settings table, but justin cautions against it without expertise and suggests seeking advanced help in Marketplace, as the install may be broken. The error blocks admin activation and email delivery, indicating deeper data or schema corruption.
# sudo ./launcher enter app
# rails c
> user = User.find_by_email("<admin_email>")
> user.admin = true
> user.save`
I get the following error:
ActiveModel::MissingAttributeError: can’t write unknown attribute ``
from /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activemodel-6.0.2.2/lib/active_model/attribute.rb:206:in with_value_from_database' Caused by ActiveRecord::StatementInvalid: PG::SyntaxError: ERROR: zero-length delimited identifier at or near """" LINE 1: ... = '2020-04-23 16:30:36.173916' WHERE "site_settings"."" = 3 ^ from /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/rack-mini-profiler-2.0.1/lib/patches/db/pg.rb:69:in exec_params’
Caused by PG::SyntaxError: ERROR: zero-length delimited identifier at or near “”“”
LINE 1: … = ‘2020-04-23 16:30:36.173916’ WHERE “site_settings”.“” = 3
^
from /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/rack-mini-profiler-2.0.1/lib/patches/db/pg.rb:69:in `exec_params’
Any ideas on how to finalise installation? It may look like a table is corrupted.
yes. Discourse without importing migration works correctly. No errors. After the backup database is restored settings cannot be modified because we get an error and trying to activate the devs email doesn’t send an email. thats why I was trying to activate the account manually, but then I encountered that error
Have you done a ./launcher rebuild app after the backup restore? Or entered the container and run rake db:migrate? That may help, but can’t say for sure until we try
Do you still have the previous instance running? If so, your best bet going forward is to destroy the new one and rebuild it with a fresh backup from the old instance.
Shall I try to clear the site_settings table and re-set them manually? Will Discourse work after I delete all records from this table manually from postgresql?