shortId should be unique per group, not unique across instance.
The "manuscript number" or shortId
assigned to manuscripts increases as a simple counter with each new manuscript added to the system. But it increases not only when a new manuscript is added to the current group, but when a manuscript is added to any group. That means there can be large gaps in the numbering for any given group, especially when a bulk import was run on a different group.
This doesn't actually break anything, but it seems messy to me, and could reduce customers' confidence that their data in one group is not impacted by changes in another group.
Fixing this will require a small change to how the next shortId
is calculated, as well as checking to ensure that no queries in the system are finding a manuscript by shortId
alone, without also specifying groupId
. We should also set a unique constraint on the combined columns of (shortId
, groupId
).