During a Discourse upgrade, omarfilip encountered a database migration error caused by a duplicate key violation in the data_explorer_queries_pkey constraint, specifically for ID -10. Unable to access the app initially due to a stopped container, merefield advised restarting it and entering the PostgreSQL shell via ./launcher enter app and su postgres -c 'psql discourse'. After inspecting the data, omarfilip found two duplicate rows with IDs 4374 and 4114, both referencing id: -10 in the plugin store. merefield clarified that the actual row IDs (not the embedded -10) should be targeted, recommending deletion of the higher ID (4374) to preserve the older entry. omarfilip executed DELETE from plugin_store_rows WHERE id = 4374; (initially missing a semicolon) and confirmed success. merefield also reminded users to test destructive queries within transactions for safety. The issue was resolved, and the upgrade proceeded successfully.
FAILED
--------------------
Pups::ExecError: cd /var/www/discourse && su discourse -c 'bundle exec rake db:migrate' failed with return #<Process::Status: pid 3194 exit 1>
Location of failure: /pups/lib/pups/exec_command.rb:112:in `spawn'
exec failed with the params {"cd"=>"$home", "hook"=>"db_migrate", "cmd"=>["su discourse -c 'bundle exec rake db:migrate'"]}
590cf0611c566ea6df5f70ffdd2cec2359e84eaea29b7abcde77d56288a46370
** FAILED TO BOOTSTRAP ** please scroll up and look for earlier error messages, there may be more than one.
rake aborted!
StandardError: An error has occurred, this and all later migrations canceled:
ERROR: duplicate key value violates unique constraint "data_explorer_queries_pkey"
DETAIL: Key (id)=(-10) already exists.
So, I suppose I need to get rid of the duplicate data_explorer_queries_pkey key.
./launcher enter app
Error response from daemon: Container 694b24a2a235e90456fb0ca770c86ac14bb914ad33ada8a18fc4777a1188d848 is not running
root@gaoa-discourse:/var/discourse#
And also:
root@gaoa-discourse:/var/discourse# su - postgres
No passwd entry for user 'postgres'