Implement FileStore.instance_wide
Database unique constraints can only operate on a single table, so to
implement the constraint on non-instance-wide stores we have to mirror
the instance_wide
field into FileStoreInScope
. For proper
integrity, it seems much safer to do this using triggers rather than
relying on keeping it perfectly in sync at the application level. We
use a pair of triggers to copy the field value over when a row in either
table is inserted or updated.
Part of #682 (closed).