PG::NotNullViolation: FOUT: null-waarde in kolom "verification_status" schendt not-null-beperking

AI-generated summary

A user, neounix, reports a PG::NotNullViolation error during a Discourse rebuild, specifically related to the verification_status column. martin identifies the issue and provides a fix in a commit c2a660ead38d278022ba00386887190ba0739544. The user confirms the fix resolves the issue after applying the patch. martin later confirms the fix is now in the tests-passed branch, and the user successfully returns to that branch, restoring normal operation neounix.

Hello,

Just did a rebuild (a number of times, to remove some plugins) and it is crashed with this error:

Caused by:
PG::NotNullViolation: ERROR:  null value in column "verification_status" violates not-null constraint
DETAIL:  Failing row contains (-1, -1, d-logo-sketch.png, 14461, null, null, /images/d-logo-sketch.png, 2020-03-15 04:26:28.409885, 2020-03-15 04:26:28.409885, _aa4aed9d6276bab017d3991051fbb9177783abe, null, null, png, null, null, null, f, null, null, null, null).

Any clues how to fix this?

Thanks.

2 likes

I am working on this, just made a fix that I think will fix it:

https://github.com/discourse/discourse/commit/c2a660ead38d278022ba00386887190ba0739544

4 likes

Thanks @martin

Just tried to rebuild again, same error:

/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.3.3/lib/active_record/tasks/database_tasks.rb:238:in `migrate'
/var/www/discourse/lib/tasks/db.rake:215:in `block in <main>'
/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/rake-13.0.1/exe/rake:27:in `<top (required)>'
/usr/local/bin/bundle:23:in `load'
/usr/local/bin/bundle:23:in `<main>'

Caused by:
PG::NotNullViolation: ERROR:  null value in column "verification_status" violates not-null constraint
DETAIL:  Failing row contains (-1, -1, d-logo-sketch.png, 14461, null, null, /images/d-logo-sketch.png, 2020-03-15 04:26:28.409885, 2020-03-15 04:26:28.409885, _aa4aed9d6276bab017d3991051fbb9177783abe, null, null, png, null, null, null, f, null, null, null, null).
/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/rack-mini-profiler-2.1.0/lib/patches/db/pg.rb:110:in `exec'

Not sure if it is relevant, but we run both a data and an app container.

No issues at all rebuilding the data container.

The error is only on the app container.

Let me know if you need more info from here.

FAILED
--------------------
Pups::ExecError: cd /var/www/discourse && su discourse -c 'bundle exec rake db:migrate' failed with return #<Process::Status: pid 3058 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'"]}
54cb19cd99ea4d6e68a5d8c5daaecce6ee0b49593ec3b3625a458c73c67a4a0b
** FAILED TO BOOTSTRAP ** please scroll up and look for earlier error messages, there may be more than one.
./discourse-doctor may help diagnose the problem.
1 like

The commit has not yet reached the tests-passed branch, so the fix will not be there yet.

1 like

Thank you so much @martin

Fantastic support! Much appreciated.

Rebuild worked like a charm with your patch.

version: c2a660ead38d278022ba00386887190ba0739544
2 likes

Awesome! The patch is now in tests-passed so you should switch back when possible :wink:

2 likes

Incredible @martin

Done!

Back on test-passed and life is back to normal here.

Thank you again for the amazingly fast support.

2 likes