After searching for a while, as well as trying and failing, I think I have solved my question and thought I'd share it with everyone.
It simply does not work as it's most likely not supported!
Using this documentation for MDB2 XML notation, I found you can use the "initialization" tag to make this happen, but the MDB2 version used in ownCloud most likely does not support this. Looking in the log after putting this tag in, I got this error message:
"app":"core","message":"Failed to update database structure (exception 'DomainException' with message 'Unknown element: initialization'
I also tried with a "unique" tag from the same documentation, but with a similar error. And previously I've asked a question on the ownCloud forum regarding foreign keys, but again with the same result. The answer then was that it was not supported, which is most likely the case regarding this as well.
Hope this helps another developer with similar issues, but be aware that this might change in the future and that they might support this then. If so, please let me know and I will delete/update this Q&A.