Link to ALTER fixing this:
https://gerrit.wikimedia.org/r/#/c/270755/1/db_patches/patch-ref_target_not_null.sql
Needs to be run on flowdb and officewiki. Can be done now.
Old background:
I think https://gerrit.wikimedia.org/r/#/c/196660/1/db_patches/patch-remove_unique_ref_indices.sql accidentally changed ref_target to be null-able. My understanding is that we just wanted to make it a blob so there would be no length limitation, but it defaulted to nullable.
Without fully noticing this, I changed flow.sql to blob not null in https://git.wikimedia.org/blobdiff/mediawiki%2Fextensions%2FFlow.git/f07c6ba71699cfaa36b63d53d7c633d4c773d215/flow.sql , but that doesn't solve anything for either installations that upgraded (production or otherwise).
See also T110446: Type of flow_ext_ref.ref_target incorrect on some tables on Beta Cluster.