Link to ALTER fixing this:
Needs to be run on flowdb and officewiki. Can be done now.
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).