Skip to content

Link FormSubmission to Input by foreign key (#639) - #651

Merged
marcvergees merged 1 commit into
fireform-core:development-approach-bfrom
abhishek-8081:issue-639-formsubmission-fk
Aug 7, 2026
Merged

Link FormSubmission to Input by foreign key (#639)#651
marcvergees merged 1 commit into
fireform-core:development-approach-bfrom
abhishek-8081:issue-639-formsubmission-fk

Conversation

@abhishek-8081

Copy link
Copy Markdown
Collaborator

Closes #639.

Adds a nullable input_id foreign key on FormSubmission referencing Input, so a submission
links to the Input it was filled from instead of only duplicating the transcript.

  • Model: FormSubmission.input_id (UUID FK to inputs.input_id, nullable), matching the
    existing Extraction.input_id style. input_text kept.
  • Migration 003 (down_revision 002): adds the FK via batch_alter_table so it works on both
    SQLite (tests) and Postgres — a plain ALTER-add-constraint isn't supported on SQLite.
    Round-trips cleanly (upgrade → downgrade → re-upgrade).
  • Sync fill (forms.py) sets input_id directly; async fill threads input_id into
    fill_form_task (as a string, per the Celery serialization convention already used in
    transcribe.py) and jobs.py passes it in.
  • input_text is intentionally KEPT — the /forms/submissions and analytics endpoints still
    read it. Migrating those readers to the FK and dropping input_text is a deferred
    follow-up (noted in the migration docstring).

@marcvergees @vharkins1 @chetanr25

@marcvergees
marcvergees merged commit e7b63a3 into fireform-core:development-approach-b Aug 7, 2026
2 checks passed
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.

2 participants