Skip to content

Document to SourceFile link + cascade semantics#55

Merged
cgoudet merged 3 commits intomainfrom
46-document-source-file-link
Apr 16, 2026
Merged

Document to SourceFile link + cascade semantics#55
cgoudet merged 3 commits intomainfrom
46-document-source-file-link

Conversation

@AymanL
Copy link
Copy Markdown
Collaborator

@AymanL AymanL commented Apr 15, 2026

Summary

  • Replaces the SourceFile → Document FK (SET_NULL) with a Document → SourceFile OneToOneField (CASCADE), making the ownership direction explicit: a Document owns its file, not the other way around
  • A Document with source_file=None remains valid (metadata-only state)
  • Deleting a SourceFile now cascades and removes the linked Document
  • Adds source_file to DocumentAdmin with raw_id_fields

Tests

  • Metadata-only Document (no SourceFile) created successfully
  • Deleting a SourceFile cascades and removes the linked Document
  • A SourceFile cannot be linked to more than one Document (IntegrityError)

Closes #46

@AymanL AymanL requested a review from cgoudet April 15, 2026 16:05
Base automatically changed from 45-parsed-artifact-model to main April 16, 2026 06:40
Copy link
Copy Markdown
Collaborator

@cgoudet cgoudet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@cgoudet cgoudet merged commit 078cd9c into main Apr 16, 2026
1 check passed
@cgoudet cgoudet deleted the 46-document-source-file-link branch April 16, 2026 06:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Document to SourceFile link + cascade semantics

2 participants