Skip to content

survey_version_question_options

Overview

Stores a question's choices. Ordinary choices, matrix rows and columns, FA input fields, and pulldown fields all live in this one table; how a row is interpreted depends on the parent question's question_type plus axis / sub_question_index.

Table Definition

Logical name Physical name Column Type PK Relation Unique Nullable Default Notes
Choice survey_version_question_options id uuid โ—ฏ gen_random_uuid() Re-assigned on every question update
question_id uuid survey_version_questions:id (cascade)
label varchar(255) Choice label. Referenced as the comparison value of branch conditions
sort_order integer Position within the question
is_exclusive boolean false Exclusive choice
allow_other_input boolean false Shows an "other" free input field
is_not_applicable boolean false The "none of the above" special choice
axis question_option_axis โ—ฏ row / column. Matrix only
placeholder text โ—ฏ Placeholder of the input field. FA only
field_is_required boolean โ—ฏ Per-field required flag. FA only
sub_question_index integer โ—ฏ Which sub-question the choice belongs to. null for flat questions / TM / FA
created_at timestamptz now()
updated_at timestamptz now()

Relations

  • question_id โ†’ survey_version_questions.id (onDelete: cascade)

Indexes

  • Primary key (id)
  • UNIQUE INDEX: survey_version_question_options_question_order_idx (question_id, sort_order)

Interpretation per Question Type

Parent question_type What a row means Columns used
single / multi A choice label / is_exclusive / allow_other_input / is_not_applicable / sub_question_index
matrix A row or a column The above plus axis (row = subject, column = rating scale)
free_text An input field label (item name) / placeholder / field_is_required
pulldown A field's choice label / sub_question_index (field position)
intro Not used โ€”

Notes

  • id is not stable: updating a question deletes the existing rows and recreates them, so id changes every time. That is why branch conditions and visibility rules reference choices by label string
  • Why one table: choices, matrix rows and columns, and FA fields are all "an ordered sequence of labels" and share attributes such as exclusivity and "other". Rather than splitting the table, interpretation is switched by the parent question's type
  • When pushing into CS, selection choices map to answer_item, matrix rows to answer_item and columns to sub_item, and FA fields to answer_item