I'm building an app with Postgres where the client can create questions for their applicants to answer. However, I want to make sure I'm designing right before I get into too much technical debt. Mainly, I have two questions:
- How should I represent answers that are either a string or an array of strings? I was previously thinking about just having the schema be an array, and then text questions would just reference the 0 index. But that seems to be not kosher. Below I broke it up into different tables.
- How could I represent schemas that the answers must adhere too? Examples include fitting some enum, being a date, or being so many characters. I figure the easiest way to do this would to just store a regex string. Any thoughts?
- How can I represent control flow for these questions? Like if the user answers that they're over 30, show this question, otherwise show another question. I don't really know how to go about that.
Here's a picture of my diagram

Table Questions {
id int [pk]
title varchar
subText varchar
type Enum
}
Table Question_Choices {
id int [pk]
question_id int [ref: > Questions.id]
value varchar
}
Table Answers {
id int [pk]
question_id int [ref: > Questions.id]
value varchar
timeSpent int
}
Table Answer_Log {
id int [pk]
answer_id int [ref: > Answers.id]
timestamp timeStamp
}
Table AnswerString {
id int [pk]
answerId int [ref: - Answers.id]
value varchar
}
Table AnswerArr {
id int [pk]
answerId int [ref: - Answers.id]
values varchar[]
}