Files
familienarchiv/docs/architecture/db/db-relationships.puml
Marcel b3d54a12c4 feat(journeyitem): V74 — partial unique index + note-length CHECK as atomic backstops
The append dedup guard was check-then-insert: two concurrent appends of the
same document both pass exists() and both insert. The partial unique index
on (geschichte_id, document_id) WHERE document_id IS NOT NULL closes the
race; append saveAndFlush-es and maps the DataIntegrityViolationException to
the same 409 JOURNEY_DOCUMENT_ALREADY_ADDED as the friendly pre-check. The
CHECK on note length pins the 2000-char contract in the schema, mirroring
chk_text_length on transcription_blocks.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-10 07:21:41 +02:00

4.3 KiB

AuthDocumentsPersonsTagsTranscriptionOCRSupportingapp_usersuser_groupsapp_users_groupsgroup_permissionspassword_reset_tokensinvite_tokensinvite_token_group_idsdocumentsdocument_receiversdocument_tagsdocument_versionsdocument_annotationsdocument_commentsdocument_training_labelscomment_mentionspersonsperson_name_aliasesperson_relationshipstagtranscription_blockstranscription_block_versionstranscription_block_mentioned_personsocr_jobsocr_job_documentsocr_training_runssender_modelsnotificationsaudit_loggeschichtengeschichten_personsjourney_itemspartial UNIQUE (geschichte_id, document_id)WHERE document_id IS NOT NULL (V74)app_user_idgroup_idgroup_idapp_user_idcreated_byinvite_token_idgroup_idsender_id (ON DELETE SET NULL)document_idperson_id (ON DELETE CASCADE)document_idtag_iddocument_ideditor_iddocument_idcreated_bydocument_idannotation_idblock_idauthor_idparent_iddocument_idcomment_idapp_user_idperson_idperson_idrelated_person_idparent_idannotation_iddocument_idcreated_byupdated_byblock_idchanged_byblock_idperson_id (ON DELETE CASCADE)job_iddocument_idtriggered_byperson_idperson_idrecipient_idactor_iddocument_idauthor_idgeschichte_idperson_idgeschichte_id (ON DELETE CASCADE)document_id (ON DELETE SET NULL)