Parent PRD
#33
What to build
Add a nullable FK from Document to SourceFile to make the metadata-only and file-attached states explicit, with the correct cascade semantics (see PRD §Implementation Decisions — Cascade deletion). No pipeline rewiring; models, migrations, and minimal admin only.
Acceptance criteria
Blocked by
User stories addressed
Reference by number from the parent PRD:
- User story 4 (SourceFile represents only the stored file)
- User story 5 (Document links to at most one SourceFile)
- User story 6 (deleting SourceFile cascades to Document)
Parent PRD
#33
What to build
Add a nullable FK from
DocumenttoSourceFileto make the metadata-only and file-attached states explicit, with the correct cascade semantics (see PRD §Implementation Decisions — Cascade deletion). No pipeline rewiring; models, migrations, and minimal admin only.Acceptance criteria
Documenthas a nullablesource_fileFK toSourceFile(on_delete=CASCADEso that deleting aSourceFiledeletes the linkedDocument).Documentwithsource_file=Noneis valid (metadata-only state).Documentcan be linked to at most oneSourceFile.Document(noSourceFile) is created successfully; deleting aSourceFilecascades and removes the linkedDocument; aDocumentcannot be linked to more than oneSourceFile.Blocked by
Documentmodel must exist)User stories addressed
Reference by number from the parent PRD: